c++cwinapi

How can I tell if a given path is a directory or a file? (C/C++)


I'm using C and sometimes I have to handle paths like

Is there a way to check if a given path is a directory or a given path is a file?


Solution

  • Call GetFileAttributes, and check for the FILE_ATTRIBUTE_DIRECTORY attribute.