如何在不将此页面保存到 C++中的磁盘的情况下将网页下载到字符串中?
URLDownloadToFile MSDN 函数仅将页面保存到磁盘。
您是否查找过其中URLXXX
提到的其他功能?怎么样:URLOpenBlockingStream
?
//implement filestream that derives from IStream
class StringStream : public IStream
{
StringStream(std::wstring buf)
{
_refcount = 1;
_mBuf = buf;
}
~ StringStream ()
{
}
// implement IUknown, IStream interfaces
private:
std::wstring _mBuf;
long _refcount;
};
在此处查看基于默认文件的 IStream 实现。