My code:
#include <QUrl>
NOTE: I run it step to step ( VS2005 debug function ).
#include <QtGui/QApplication>
#include <QHttp>
#include <QFile>
int main(int argc, char *argv[])
{
if(!file
->open
(QIODevice::WriteOnly)) //file create { QMessageBox::information(0,
"Get User's Profile",
"Error: Cannot open["+file
->fileName
()+"] "+file
->errorString
());
return 0;
}
QUrl *url
=new QUrl("http://localhost/a2gold/index.php");
http->get(url->path(),file);
http->close();
file->flush(); //Now,file is empty
return app->exec(); //since there,file is valid(have content)}
#include <QUrl>
NOTE: I run it step to step ( VS2005 debug function ).
#include <QtGui/QApplication>
#include <QHttp>
#include <QFile>
int main(int argc, char *argv[])
{
QApplication *app=new QApplication(argc, argv);
QFile *file=new QFile("index.php");
if(!file->open(QIODevice::WriteOnly)) //file create
{ QMessageBox::information(0,"Get User's Profile","Error: Cannot open["+file->fileName()+"] "+file->errorString());
return 0;
}
QUrl *url=new QUrl("http://localhost/a2gold/index.php");
QHttp *http=new QHttp(url->host());
http->get(url->path(),file);
http->close();
file->flush(); //Now,file is empty
return app->exec(); //since there,file is valid(have content)}
To copy to clipboard, switch view to plain text mode
How can I get a valid(have content) file before the "return app->exec()"
I want use the file content, but I must finish the application for get a valid(have content) file .
I see the example already , but I can't understand it
Bookmarks