C++ builder 如果读取网页的源代码
比如说我想读取百度首页的HTML,应如果读取,我是做.NET开发的,对C++ 一点不懂,希望高手能写个函数
AnisiString gethtml(url)
{
return "结果";
}
谢谢了
[解决办法]
TStrings* gethtml(ANsiString url)
{
TIdHTTP *http=new TIdHTTP(null);
http->ReadTimeout=3000;
TStringList *na=new TStringList();
TMemoryStream *s=new TMemoryStream();
http->Get(url,s);
s->Position=0;
na->LoadFromStream(s);
delete http,s;
//na->SaveToFile("mydata.txt");
return na;
}