Does anyone outhere have experience creating program using QFtp class..?, if you don't mind plz give me sample copy of that program.
thank for help.
comlink21
Printable View
Does anyone outhere have experience creating program using QFtp class..?, if you don't mind plz give me sample copy of that program.
thank for help.
comlink21
Hello,
sample program in Qt install dir: examples/network/ftp/
And also available online at: http://doc.trolltech.com/4.3/network-ftp.html
Thank you for the answer, but sorry i didn't mention before. waht i want is sample program not under GUI environment. actually i have test the following program but not run.
#include <QFtp>
#include <iostream>
using namespace std;
int main(int argc, char ** argv)
{
Qftp *ftp = new Qftp ();
ftp->connectToHost("ftp.trolltech.com");
ftp->login("","");
ftp->list();
ftp->close();
return 0;
}
when i compile there is no error, but when i call the program there is command:
QObject::startTimer:QTimer can only be used with threads started with QThread
your help is appreciated.
thanks
comlink21
From QFtp docs:
You must construct an application object and enter to an event loop. QFtp will inform you via signals when something happens.Quote:
The class works asynchronously, so there are no blocking functions. If an operation cannot be executed immediately, the function will still return straight away and the operation will be scheduled for later execution. The results of scheduled operations are reported via signals. This approach depends on the event loop being in operation.
Here's a minimal example listing contents of ftp.trolltech.com root dir:
Code:
// main.cpp #include <QCoreApplication> #include <QDebug> #include <QFtp> { Q_OBJECT public: { } protected slots: void doListInfo(const QUrlInfo& info) { qDebug() << info.name(); } }; int main(int argc, char* argv[]) { Ftp ftp; ftp.connectToHost("ftp.trolltech.com"); ftp.login(); ftp.list(); ftp.close(); return app.exec(); } #include "main.moc"
Hi
I am trying to use the above mentioned code but am running nto issues. I see the following:
:-1: error: No rule to make target `debug/main.moc', needed by `debug/Ftp.o'. Stop.
Any idea how to fix this?
Thanks in advance.
Run qmake and then build.
Or move class definition into a header file and drop the #include "main.moc".