判断路径是目录还是文件

//strPath为需要判断的路径

if ( GetFileAttributes(strPath) & FILE_ATTRIBUTE_DIRECTORY )
{
    MessageBox("Is a Directory");
}
else
{
    MessageBox("Is not a Directory");
}

 

还可以用以下函数

BOOL PathIsDirectory(          LPCTSTR pszPath
);
Verifies that a path is a valid directory。

 

posted @ 2015-01-20 23:53  Lthis  阅读(415)  评论(0编辑  收藏  举报