这段程序
strPathName="C://MyCalendar//todolist.txt";
FILE *pFile=fopen(strPathName,"r");
int count=0;
fscanf(pFile,"%d",&count);
char* str;
CString tmp;
for (int i=0; i<count; i++)
{
fscanf(pFile,"%s",&str);
}
这段程序在编译的时候没有任何错误
不过程序一运行就出现了 一件令人吃惊的事情
比如todolist.txt中有两行数据
1
Abcdefgh
那么count=1,str=Abcdefgh这是我所希望的
但是
在count取到1之后,进入了for循环,
str取到Abcdefgh,可是count的值也改变了
5093

被折叠的 条评论
为什么被折叠?



