From: LRN <lr...@gm...> - 2011-10-30 15:32:35
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 30.10.2011 19:18, C. Meli wrote: > Hello all, what is the preferred mingw way to test whether a file > is a directory ? > > Best regards and thanks in advance CM > Well, one way would be to do: DWORD error, attributes = 0; SetLastError (0); attributes = GetFileAttributesA (filename); error = GetLastError (); if (attributes == INVALID_FILE_ATTRIBUTES || error != NO_ERROR) { /* handle the error */ } else if (attributes & FILE_ATTRIBUTE_DIRECTORY) { /* It's a directory */ } else { /* It is not a directory */ } -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJOrW4FAAoJEOs4Jb6SI2CwM8gH/2mdIIm82AjL42OkjhsbrgIE 9uN+m5Arj1JVhM7D72SMSNwex1nct7mYXCyUiOQkVSxtA1Qzk9YVKuIt0ZpsV+X2 5ZJRpd2KlZNChL0pEcjSV7zZubFMjaK+bLsUvC0gk5LDJUq8jPEzLq4IPW+dSf7r hg9RCSkJaHLfikVUPGFH4DUAq4khk21rStqoGVlximr1W9RwsiUiC2VbH3WCU65e EH82Rb/rNuaxbnvC0GchkFm8E9ic7srZ22q0h6ep2sWRzCLOmHyaIR2yD7VA0uDw fgNHPi9vp7C1BwCWxz/CsMWIjkfiTruFeNdRH5Yepnv4B5rI0k2Uaqgx2Y/yh8M= =OSEX -----END PGP SIGNATURE----- |