如何检查vc ++中目录(文件夹)是否存在? [英] How to check whether the directory(folder) exists or not in vc++?
本文介绍了如何检查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[^]
这篇关于如何检查vc ++中目录(文件夹)是否存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文