hi all, i'd like to insert in my application the possibility to read txt file from server. I've read that i can make this using class QNetwrkAccessManager, but i don't understand how can i retrive file read.
could you help me? thanks.
hi all, i'd like to insert in my application the possibility to read txt file from server. I've read that i can make this using class QNetwrkAccessManager, but i don't understand how can i retrive file read.
could you help me? thanks.
Last edited by Alexiuscrow; 2012-07-25 at 18:30.
S suppose you could do Normal HTTP GET operation.
Hello,
You can read a file using QNetworkAccessManager like following:
Br,Code://in private section of your class .h QNetworkAccessManager* manager; QNetworkReply* reply //in the cpp void ClassName::readFile() { manager = new QNetworkAccessManager(this); reply = manager->get(QNetworkRequest("http://url/to/file")); QObject::connect(reply, SIGNAL(finished()), this, SLOT(finished())); } void ClassName::finished() { QByteArray fileData = reply->readAll(); //Do something with fileData }
Villep
thx. but "QNetworkAccessManager: No such file or directory"
Try both
also in .pro you should haveCode:#include <QtNetwork/QNetworkAccessManager> or #include <QNetworkAccessManager>
Code:QT += network