mfc 编写读取两个文件时遇到了 问题

慢慢de走 2016-07-28 10:16:38
0x0095E416 处有未经处理的异常(在 读取列.exe 中): 0xC0000005: 写入位置 0xCCCCCCCC 时发生访问冲突。

以上为提示
...全文
318 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
sevancheng 2016-07-29
  • 打赏
  • 举报
回复
用 fopen fwrite fread 吧,MFC很多东西不可控,里面各种断言,抛异常的
慢慢de走 2016-07-28
  • 打赏
  • 举报
回复
引用 2 楼 VisualEleven 的回复:
自己Debug下单步调试一下,看看哪里错误了?文件打开的地方是否成功?
上一个问题我解决了 ,,但是还有一个问题:我想让这个static text控件 一直循环显示 这两个数组里的数据(现在是循环完一遍 就停止了),请问怎么可以办到呢?
Eleven 2016-07-28
  • 打赏
  • 举报
回复
自己Debug下单步调试一下,看看哪里错误了?文件打开的地方是否成功?
慢慢de走 2016-07-28
  • 打赏
  • 举报
回复
CStdioFile cf(L"x.txt",CFile::modeRead);
CString content;
string x[4];
string s;
string m;
int i = 0;
while (cf.ReadString(content)){
if (content == ""){
continue;
}
else{
s = CStringA(content);
istringstream is(s);
is >> m >> x[i];
i++;
}
}

CStdioFile cfy(L"y.txt",CFile::modeRead);
CString cy;
string cony[4];
string in;
string laji;
int j = 0;
while (cfy.ReadString(cy)){
if (cy == ""){ continue; }
else{
in = CStringA(cy);
istringstream isy(in);
isy >> laji >> cony[j];
j++;
}
}

for (int i = 0; i < 4; i++){
CString out(x[i].c_str());
CString out1(cony[i].c_str());
Sleep(1000);
SetDlgItemText(IDC_wenben,L"xxxxxx"+out+L"yyyy"+out1);

}
}



这是我写的代码
060 2016-07-28
  • 打赏
  • 举报
回复
引用 楼主 qq_28810319 的回复:
0x0095E416 处有未经处理的异常(在 读取列.exe 中): 0xC0000005: 写入位置 0xCCCCCCCC 时发生访问冲突。 以上为提示
你对问题的描述,没有一点有用的信息!! 看看这个 《提问的智慧》 http://www.jianshu.com/p/60dd8e9cd12f

2,586

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 资源
社区管理员
  • 资源
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧