The position should be that returned by a previous telldir subroutine call. The rewinddir subroutine resets the position of the specified directory stream to the beginning of the directory. The closedir subroutine closes a directory stream and frees the structure associated with the DirectoryPointer parameter. Parameters DirectoryName Names the directory. DirectoryPointer Points to the DIR structure of an open directory.
Location Specifies the offset of an entry relative to the start of the directory.
On successful completion, the opendir subroutine returns a pointer to an object of type DIR . Otherwise, a null value is returned and the errno global variable is set to indicate the error. On successful completion, the readdir subroutine returns a pointer to an object of type struct dirent . Otherwise, a null value is returned and the errno global variable is set to indicate the error. When the end of the directory is encountered, a null value is returned and the errno global variable is not changed by this function call.