The rewinddir function resets the position of the specified directory stream to the beginning of the directory. It also causes the directory stream to refer to the current state of the corresponding directory, the same as using the opendir function. If the dir_pointer argument does not refer to a directory stream, the effect is undefined. The type DIR, defined in the <dirent.h> header file, represents a directory stream. A directory stream is an ordered sequence of all the directory entries in a particular directory. Directory entries represent files. See also opendir.