Standards
Standards / Extensions |
C or C++ |
Dependencies |
XPG4.2
Single UNIX Specification, Version 3
|
both |
|
Format
#define _XOPEN_SOURCE_EXTENDED 1
#include <unistd.h>
int fchdir(int fildes);
General description
The fchdir()
function has the same effect as chdir()
except that the directory that is to be new current working directory
is specified by the file descriptor fildes.
Returned value
If successful, fchdir()
changes the working directory and returns 0.
If unsuccessful,
fchdir() does not change the working directory, returns -1, and sets
errno to one of the following values:
- Error Code
- Description
- EACCES
- Search permission is denied for the directory referenced by fildes.
- EBADF
- The fildes arguments is not an open
file descriptor.
- ENOTDIR
- The open file descriptor fildes does
not refer to a directory.