#include <windows.h>
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
hFind = FindFirstFile(pathname, &FindFileData);
if(hFind==INVALID_HANDLE_VALUE)
//error
else
{
while(!FindNextFile(hFind,&FindFileData))
{
}
//is the file
FindClose(hFind);
if(FindFileData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
//directory
}