Skip to content

Instantly share code, notes, and snippets.

@javagg
Created August 29, 2012 05:41
Show Gist options
  • Save javagg/3507213 to your computer and use it in GitHub Desktop.
Save javagg/3507213 to your computer and use it in GitHub Desktop.
qtdownloadfile
#include <QtCore/QCoreApplication>
#include <QtNetwork>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QNetworkAccessManager manager;
QNetworkReply *reply = manager.get(QNetworkRequest(QUrl("http://www.tiexue.net")));
QEventLoop loop;
QObject::connect(reply, SIGNAL(readyRead()), &loop, SLOT(quit()));
loop.exec();
qDebug(reply->readAll());
return a.exec();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment