Skip to contentSkip to conversation

opening a directory, and reading it's contents

DISCUSSION Nick Jennings 2 participants 2 messages Aug 31, 2002

lore
Share & tools
lore
#1 lore raw
In reply to Nick Jennings
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]>
#0 lore raw

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