craigix
Mega GP Mania
Does anyone know how to tell when readdir returns a dir name and not a file name? It just seems to give you a list of the current dir contents regardless of type.
Google does not seem to know the answer either, I have came up with a complex way of finding out if each entry is a file or dir but it seems a bit over the top and time consuming, how do other people do it?
Thanks,
Craig
I posted too soon, someone posted the answer to my question on the dev channel just now:
<Mindlord> craigx... stat(entry->d_name, &statbuf)... if S_ISDIR(statbuf.st_mode) it's a DIR, if S_ISREG(statbuf.st_mode) it's a regular file... see: http://www.scit.wlv.ac.uk/~jphb/spos/notes/calls/stat.html
<craigix> thanks
<Mindlord> No prob
Google does not seem to know the answer either, I have came up with a complex way of finding out if each entry is a file or dir but it seems a bit over the top and time consuming, how do other people do it?
Thanks,
Craig
I posted too soon, someone posted the answer to my question on the dev channel just now:
<Mindlord> craigx... stat(entry->d_name, &statbuf)... if S_ISDIR(statbuf.st_mode) it's a DIR, if S_ISREG(statbuf.st_mode) it's a regular file... see: http://www.scit.wlv.ac.uk/~jphb/spos/notes/calls/stat.html
<craigix> thanks
<Mindlord> No prob