Resets the position of a directory stream to the first entry in a directory.
#include <dirent.h> void rewinddir ( DIR *dirp);
(IN/OUT) Points to the directory to set so that dirp points to the first entry. For information about the structure, see DIR.
The rewinddir function causes the directory stream to refer to the current state of the corresponding directory, as a call to opendir would have done.
If dirp does not refer to a directory stream, the effect is undefined