#include <windows.h>
char FileOrDirName[MAX_PATH] = "X:\\Whatever\\you\\want";
DWORD dwAttr = GetFileAttributes ( FileOrDirName );
if ( dwAttr == 0xffffffff )
{ // failure, reason could be not present, access denied
// or something else
DWORD dwReason = GetLastError ( );
... } else
{ if ( dwAttr & FILE_ATTRIBUTE_DIRECTORY )
{ // it is a directory
... } else
{ // it is a file
... } }