QString basePath = "http://repo.inmac.org/";QString named;...void Downloader::httpFinished(QNetworkReply *reply){ QFile file("../Resources/"+named); if (file.open(QIODevice::WriteOnly)) { ....}
C++ (Qt)QNetworkAccessManager qnam;QNetworkReply *reply = qnam.get(QNetworkRequest(QUrl("http://www.prog.org.ru")));QEventLoop loop;connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));loop.exec(); QString answer = reply->readAll();//qDebug() << answer; QFile file(QDir::currentPath() + "/test.html");file.open(QIODevice::WriteOnly);file.frite(answer.toUtf8());file.close;
C++ (Qt) QNetworkAccessManager qnam; QNetworkReply *reply = qnam.get(QNetworkRequest(QUrl("http://download.trigen.pro/"+path+fname))); QEventLoop loop; connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); loop.exec(); QFile file("./EasyKitAssistant.app/Contents/"+fname); if (file.open(QIODevice::WriteOnly)) { file.write(reply->readAll()); file.flush(); file.close(); }
C++ (Qt) if (file.open(QIODevice::WriteOnly)) { file.write(reply->readAll()); file.flush(); file.close(); }