The opendir function opens the directory specified by dir_name and associates a directory stream with it. The dir_name argument can be specified in OpenVMS style or UNIX style. The directory stream is positioned at the first entry. 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. The opendir function also returns a pointer to identify the directory stream in subsequent operations. The NULL pointer is returned when the directory named by dir_name cannot be accessed, or when not enough memory is available to hold the entire stream. NOTES o An open directory must always be closed with the closedir function to ensure that the next attempt to open that directory is successful. The opendir function should be used with readdir, closedir, and rewinddir to examine the contents of the directory. o The opendir function supports UNIX style path name specifications.