CHttpFile问题
时间:2011-12-18
来源:互联网
C/C++ code
上面这段代码总有错,错误提示为:
CPP.exe 中的 0x6e65633a 处有未经处理的异常: 0xC0000005: 读取位置 0x6e65633a 时发生访问冲突
按照注释里面写的,把100改成50则没有错了,这是怎么回事。。
CInternetSession sess(_TEXT("")); CHttpFile* file = (CHttpFile*)sess.OpenURL(_TEXT("http://www.baidu.com")); string strHtml; char sRecived[100]; while(file->ReadString((LPTSTR)sRecived,100) != NULL)/// 这里有错,把100改成50就没错了。。 { strHtml += sRecived; } cout << strHtml << endl; file->Close(); cin.get();
上面这段代码总有错,错误提示为:
CPP.exe 中的 0x6e65633a 处有未经处理的异常: 0xC0000005: 读取位置 0x6e65633a 时发生访问冲突
按照注释里面写的,把100改成50则没有错了,这是怎么回事。。
作者: ereere235 发布时间: 2011-12-18
CInternetFile::ReadString
Call this member function to read a stream of characters until it finds a newline character. The function places the resulting line into the memory referenced by the pstr parameter. It stops reading characters when it reaches the maximum number of characters, specified by nMax. The buffer always receives a terminating null character.
改成:file->ReadString((LPTSTR)sRecived,99)
Call this member function to read a stream of characters until it finds a newline character. The function places the resulting line into the memory referenced by the pstr parameter. It stops reading characters when it reaches the maximum number of characters, specified by nMax. The buffer always receives a terminating null character.
改成:file->ReadString((LPTSTR)sRecived,99)
作者: agoago_2009 发布时间: 2011-12-18
引用 1 楼 agoago_2009 的回复:
CInternetFile::ReadString
Call this member function to read a stream of characters until it finds a newline character. The function places the resulting line into the memory referenced by the pstr p……
CInternetFile::ReadString
Call this member function to read a stream of characters until it finds a newline character. The function places the resulting line into the memory referenced by the pstr p……
改成99也还是有那个错误。。
作者: ereere235 发布时间: 2011-12-18
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28