char* pFileName="kkk.txt";
CStdioFile f1;
if(!f1.Open(pFileName,CFile::modeCreate|CFile::modeWrite|CFile::typeText))
{
#ifdef _DEBUG
afxDump<<"unable to open file"<<"\n";
#endif
}kkk.txt在vc这个工程的文件夹中,为何始终打不开?说unable to open file

解决方案 »

  1.   

    你运行Release 版的是试试, 
    #ifdef _DEBUG
    afxDump<<"unable to open file"<<"\n";
    #endif是什么意思呀? 或去掉这几行试试.
      

  2.   

    换种读取方式,比如FILE *fp;
    fp=fopen("kkk.txt","wb");
    fread(....);
    fwrite(....);
    fclose(fp);
      

  3.   

    #ifdef _DEBUG
    afxDump<<"unable to open file"<<"\n";
    #endif
    应该是一个编译开关吧
      

  4.   

    去掉
    #ifdef _DEBUG
    afxDump<<"unable to open file"<<"\n";
    #endif
      

  5.   

    好像这三行代码是说
    只要是在DEBUG状态就显示这个出错信息
    然后不带开文件直接返回
      

  6.   

    好像这三行代码是说
    只要是在DEBUG状态就显示这个出错信息
    然后不带开文件直接返回