opening a directory, and reading it's contents
Hi,
I can't seem to find the function I am looking for. I'd like to open a directory for reading, and iterate through the contents of it (filenames, directories etc).
Is there a platoform independant way to do this?
What's the linux-specific way to do it?
Any elaboration welcome, thanks.
- Nick
Quoted 5 lines · Nick Jennings
I can't seem to find the function I am looking for. I'd like to open a directory for reading, and iterate through the contents of it (filenames, directories etc).
Is there a platoform independant way to do this?
opendir/readdir/closedir works on all Unix-like systems; that's as portable as it gets.
Quoted 1 line
What's the linux-specific way to do it?
There isn't one.
There is getdents() but, although this is less portable than the above, it isn't actually Linux-specific.
Signature · 1 line
Glynn Clements <[email protected]>