C++ to figure out if a file is a directory?
Displaying 1-4 of 4 total.
1
mcgrue
|
After a lot of searching (hey, variations on the theme of googling "C++ directory" aren't very helpful) I boiled stuff down to this.
http://msdn.microsoft.com/en-us/library/221w8e43(VS.80).aspx
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
|
Overkill
|
A way that I think works but I don't claim to be efficient in any way is a just use ListFilePattern on filename + "/*" . If there aren't at least the two entries, "." and "..", you know it isn't a directory.
... :D
Posted on 2008-07-07 21:40:46 (last edited on 2008-07-07 21:41:10)
|
Kildorf
|
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)
|
TheDudeFormerlyKnownAsDevlyn
|
Hey McGrue,
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:
http://www.koders.com/c/fid3CFC1D9AA32AF825011A59F116E72EA4447A5B43.aspx
Cheers & good luck coding!
-Derek
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
|