如何检查vc ++中目录(文件夹)是否存在?
问题描述:
如何检查文件夹是否存在?
How to check whether the folder exists or not?
答
这将告诉您文件或目录是否存在...
This will tell you if a FILE or DIRECTORY exists or not...
BOOL FolderExists(CString strFolderName)
{
return GetFileAttributes(strFolderName) != INVALID_FILE_ATTRIBUTES;
}
希望这对您有帮助...
Hope this helps...
嘿,只需尝试一下,
Hey Simply try this,
if(!CreateDirectory(FileName))
{
MessageBox("Directory is already exist!");
}
检查PathIsDirectory,
http://msdn.microsoft.com/en-us/library/bb773621%28v = vs.85%29.aspx [ ^ ]
Check PathIsDirectory,
http://msdn.microsoft.com/en-us/library/bb773621%28v=vs.85%29.aspx[^]