看看msdn上关于cfile的介绍吧!

解决方案 »

  1.   

    您以前是用VB的吧?不是用什么函数去open,而是用文件指针!FileSeek,它用来指明数据写入文件的位置。
      

  2.   

    2, 用API:FileExists
    3,EOF函数
      

  3.   

    1)CFile::modeWrite|CFile::modeRead然后SeekToEnd();
    2)Open时返回0则文件不存在(不要使用modeCreate参数)
    3)使用GetPosition()和GetLength()比较
      

  4.   

    http://www.csdn.net/expert/topic/123/123158.shtm
    大家帮我看看吧,不然只有放弃Vc了
      

  5.   

    1) 最好是:
    file.Open(strFileName, CFile::modeWrite | CFile::shareDenyWrite);
    2) 最安全的做法:
    BOOL FileExists(LPCTSTR lpszFileName)
    {
    WIN32_FIND_DATA findFileData; HANDLE hFind = FindFirstFile(lpszFileName, &findFileData);
    if (hFind == INVALID_HANDLE_VALUE)
    return FALSE;
    VERIFY(FindClose(hFind));
    return !(findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
    }
    3) EOF = file.GetPosition() >= file.GetLength();http://263.csdn.net/edyang/