【求助】请教关于 fopen的问题,和 CException的问题,多谢
我写了个写文件的代码,如下:
char name[] = "c:\\test.txt";
FILE *fp = fopen(name,"w+");
try
{
for (int index = 0; index <= attArray.GetUpperBound(); ++index)
{
fprintf(fp,"%s\n","test test");
}
}
catch (CException* e)
{
TCHAR szCause[255];
CString strFormatted;
e->GetErrorMessage(szCause, 255);
AfxMessageBox(szCause);
}
fclose(fp);
但是,每次执行到try里的代码都会出错关闭,也捕捉不到异常,
不执行try里的代码就不出错,说明fopen没有问题,但是
调试时,fopen后,fp指针有地址不为空,但 提示什么 “错误指针”?
请问有哪些可能的原因?
是不是哪些地方有冲突?
多谢