RT

解决方案 »

  1.   

    FILE * fp;
    if((fp=fopen(filename,"r"))
    {
    fclose(fp);
    //文件存在
    }
    else
    {
    //文件不存在
    }
      

  2.   

    我通常使用以下两种方式:// 判断文件是否存在
    BOOL IsFileExist( CString strFileName )
    {
    WIN32_FIND_DATA FindFileData;
    HANDLE hFind; // 判断参数文件是否存在
    hFind = FindFirstFile( (LPCTSTR)strFileName, &FindFileData );
    if ( hFind == INVALID_HANDLE_VALUE )
    return FALSE; return TRUE;
    }二、#include <shlwapi.h>                  // PathFileExists#pragma comment(lib, "Shlwapi.lib")if( !PathFileExists( m_pszFileName ) )
        return E_FAIL;
      

  3.   

    推荐:
    http://expert.csdn.net/Expert/topic/1901/1901755.xml?temp=.8467981
      

  4.   

    http://expert.csdn.net/Expert/topic/1901/1901755.xml?temp=.8467981
    里有相关的代码与解释。