Date: 2009jul16
Platform: win32
Language: C/C++
Q. How can I see if a path is a folder ?
A. Here's an easy function for that:
BOOL IsDir(LPCSTR szDir)
{
DWORD dwAttrib;
if ((dwAttrib = GetFileAttributes(szDir)) == 0xFFFFFFFF) return FALSE;
return dwAttrib & FILE_ATTRIBUTE_DIRECTORY;
}
ExampleUse()
{
if (IsDir("c:\\Documents and Settings"))
{
printf("You have a D&S folder\n");
}
else
{
printf("You do NOT have a D&S folder\n");
}
}
| What this info useful to you? You can donate to say thanks |
Add a comment
Sign in to add a comment