Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

dirfd - extract file descriptor

&pagelevel(4)&pagelevel

Syntax

#include <dirent.h>
int dirfd(DIR *dirp); 

Description

The function dirfd() extracts the file descriptor from the DIR object to which dirp points.
If an attempt is made to close or modify the file descriptor with functions other than
closedir(), readdir(), readdir_r(), rewinddir() or seekdir(), the behaviour is
undefined.

Return val.

File descriptor of the DIR object


if successful.

-1

if an error occurs. errno is set to indicate the error.

Errors

dirfd() fails, if:

EINVAL      dirp does not point to an open directory stream.

See also

closedir(), readdir(), readdir_r(), rewinddir(), seekdir()