我想用Qt的QHttp类来获取本地Web Service的数据,用了下面的代码,想把index.html的内容获取并存储在一个文本文件中,但是文件创建了,却没有内容,是我的代码有问题,还是因为这个类只能在企业版中使用?但是下面的代码编译并没有问题。我用的版本是Qt3.3.6,请高手给解释一下,谢谢!
url=new QUrl("http://localhost/index.html"); // QUrl *url;
http=new QHttp(); // QHttp *http;
file=new QFile("index.txt"); // QFile *file;
if (!file->open(IO_WriteOnly)) {
QMessageBox::critical(this, "ERROR", "Create file error");
return;
}
http->setHost(url->host(), 80);
http->get(url->path(),file);
[ 此贴被sflute在2007-08-01 11:44重新编辑 ]