[C++] probleme de connexion ftp

Xenon -  
Char Snipeur Messages postés 9813 Date d'inscription   Statut Contributeur Dernière intervention   -
Bonjour tout le monde,

j'ai un script censé se connecter à un ftp. La connexion se passe bien, mais dès que je veux récupérer le nom des fichiers présent pour en faire la liste, le QMessageBox (voir le code ci-dessous) m'afficher un ".", seulement ça au lieu de m'afficher le nom du fichier.

Mon code :

void Window::connectToFtp() {
	m_ftp = new QFtp(this);
	
	connect(m_ftp, SIGNAL(listInfo(const QUrlInfo &)), this, SLOT(creerListe(const QUrlInfo &)));
	connect(m_ftp, SIGNAL(commandFinished(int, bool)), this, SLOT(finDeCommande(int, bool)));
	connect(m_ftp, SIGNAL(done(bool)), this, SLOT(finDeConnexion()));

	m_ftp->connectToHost("ftp", 21);
	m_ftp->login("pseudo", "motDePasse");
	m_ftp->cd("/www"); // Le répertoire /www/ est la racine de mon compte FTP
}

void Window::creerListe(const QUrlInfo & url) {
	QString name = url.name();
	QMessageBox::information(this, "test", name);
}

void Window::finDeConnexion() {
	m_ftp->abort();
	m_ftp = 0;
}

void Window::finDeCommande(int idCommande, bool erreur) {
	switch(m_ftp->currentCommand()) {
		case QFtp::ConnectToHost :
			if(erreur) {
				QMessageBox::critical(this, tr("FTP"), tr("Impossible de se connecter au serveur ftp").arg("host"));
			}
		break;
		case QFtp::Login : 
			m_ftp->list();
		break;
	}
}

1 réponse

Char Snipeur Messages postés 9813 Date d'inscription   Statut Contributeur Dernière intervention   1 299
 
Il manque pas mal de code pour que l'on puisse t'aider.
0