in reply to Opendir, readdir & closedir.

IIRC you need to use rewinddir. The reason is that you have read the entire directory, i.e you're pointing at the end of the directory list and you need to rewind to the beginning, or course you can do the whole opendir thing again.

You can have single opendir/closedir with many readdirs if you use rewinddir.

CC