Updated: April 19, 2023 |
Open the directory associated with a file descriptor
#include <dirent.h> DIR * fdopendir( int fd );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The fdopendir() function is equivalent to the opendir() function except that the directory is specified by a file descriptor instead of a name. The file offset associated with the file descriptor (at the time fdopendir() is called) determines the entries to return.
After fdopendir() successfully returns, the file descriptor is controlled by the system. If an attempt is made to close the file descriptor or modify the state of the associated description, other than by calling the functions closedir(), readdir(), readdir_r(), rewinddir(), or seekdir(), the behavior is undefined.
Call closedir() to close the DIR stream; this also closes the file descriptor.
A pointer to the DIR stream, or NULL if an error occurred (errno is set).
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |