3
How do I check if a directory exists using C++ and Windows API?
3
How do I check if a directory exists using C++ and Windows API?
4
There is the function GetFileAttributesA
that retrieves system attributes
for a specified directory or file.
More information -> MSDN
Here a simple function that does exactly what you want:
bool HYPNOS_DIR_VALIDATE(const std::string& hypnos_dirNAME)
{
DWORD hypnos_ftyp = GetFileAttributesA(hypnos_dirNAME.c_str());
if (hypnos_ftyp == INVALID_FILE_ATTRIBUTES)
return false; // algo de errado com o path
if (hypnos_ftyp & FILE_ATTRIBUTE_DIRECTORY)
return true; // É um diretório!
return false; // Não é um diretório.
}
Browser other questions tagged c c++ windows directory winapi
You are not signed in. Login or sign up in order to post.
What is the "Hypnos"?
– pmg
Dude... kkkkk is just a project of mine.. :)
– user17270
Okay! Good luck with your project. Have fun!
– pmg
Hahaha, thank you!
– user17270