我发现我的:
GetDocument()->OnSaveDocument(GetDocument()->m_pathname);
并没有提示说该文件已经存在,而是一声不吭地覆盖掉了。
我只好自己写了,可是怎么判断呢?请教!

解决方案 »

  1.   

    you can also try
    _stat(...)
    or
    _access(...)
    or
    FindFirstFile
      

  2.   

    for example, BOOL FileExists( const TCHAR* pszName )
    {
    WIN32_FIND_DATA fData; HANDLE hFile= FindFirstFile( pszName, &fData);
    if (hFile!= INVALID_HANDLE_VALUE)
    {
    FindClose(hFile);
    return TRUE;
    }    return FALSE;
    }
      

  3.   

    我是这样判断的:
       CFileFind ffind;
       if(ffind.FindFile((LPCTSTR)strFileName){//如果改文件存在