
vc判断文件是否存在
方法一:PathFileExists(FilePath); 返回true则存在,返回false则不存在,注意要加上以下代码:
#include <shlwapi.h>
#pragma comment(lib,"Shlwapi.lib")
方法二:CFile::GetStatus(WMSIniFilePath,filestatus),返回true则存在,返回false则不存在
参数:
rStatus:
A reference to a user-supplied CFileStatus structure that will receive the status information. The CFileStatus structure has the following fields:
CTime m_ctime The date and time the file was created.
CTime m_mtime The date and time the file was last modified.
CTime m_atime The date and time the file was last accessed for reading.
LONG m_size The logical size of the file in bytes, as reported by the DIR command.
BYTE m_attribute The attribute byte of the file.
char m_szFullName[_MAX_PATH] The absolute filename in the Windows character set.
lpszFileName:
A string in the Windows character set that is the path to the desired file. The path can be relative or absolute, but cannot contain a network name.