Hi all! Is there a Windows function that check me if it's a directory? If it doesn't exist, is there a mode?
This is a discussion on Function: check if it's a directory within the Windows Programming forums, part of the Platform Specific Boards category; Hi all! Is there a Windows function that check me if it's a directory? If it doesn't exist, is there ...
Hi all! Is there a Windows function that check me if it's a directory? If it doesn't exist, is there a mode?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I support http://www.ukip.org/ as the first necessary step to a free Europe.
Or even more succintly
PathIsDirectory Function (Windows)
thank you both!
For other user that they will have same problem, this is the solution:
Code:... isDirectory = GetFileAttributes( struttura.cFileName ); if ( isDirectory == FILE_ATTRIBUTE_DIRECTORY ) cout << "it's a dir" << endl; else cout << "it isn't a dir" << endl; ....
It's still wrong -> File Attribute Constants (Windows)
The result is a bit-mask, so your example would fail for a hidden directory.
You need to do
Code:isDirectory = GetFileAttributes( struttura.cFileName ); if ( ( isDirectory & FILE_ATTRIBUTE_DIRECTORY ) == FILE_ATTRIBUTE_DIRECTORY )
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I support http://www.ukip.org/ as the first necessary step to a free Europe.