C++ to figure out if a file is a directory?
Displaying 1-4 of 4 total.
After a lot of searching (hey, variations on the theme of googling "C++ directory" aren't very helpful) I boiled stuff down to this.
God. Why isn't there a standard isDir() or something?
Anyways, mac and unix folks: am I going down a horrible w32 -only branch of getting this functionality in? Is there something way simpler I'm missing because I'm not an uber cpp haxx0r?
Posted on 2008-07-05 00:43:36
A way that I think works but I don't claim to be efficient in any way is a just use
filename + "/*". If there aren't at least the two entries, "." and "..", you know it isn't a directory.
Posted on 2008-07-07 21:40:46 (last edited on 2008-07-07 21:41:10)
I just want to say that replacing the w32-only crap that dealt with files so that it actually worked the same way on non-w32 was a huge pain in the ass! :D
Posted on 2008-07-10 22:11:23 (last edited on 2008-07-10 22:12:47)
Nice to be here again for the first time in like.... eurrr... 6 years?
Anyhow, C++ usually doesn't feature some of these obvious things, because they're already facilitated by good 'ol C.
Try this link, for example:
Cheers & good luck coding!
P.s. small Google advice: try sticking words together without spaces in your queries (like so many nerds do). For example, I typed in "C isdir" and got a nice result right away.
Posted on 2009-07-20 13:52:49