Directory pointed to by the file descriptor becomes the current working directory.
Standard C Library (libc.a)
#include <unistd.h>
int fchdir (int Fildes)
The fchdir subroutine causes the directory specified by the Fildes parameter to become the current working directory.
| Item | Description |
|---|---|
| Fildes | A file descriptor identifying an open directory obtained from a call to the open subroutine. |
| Item | Description |
|---|---|
| 0 | Successful completion |
| -1 | Not successful and errno set to one of the following. |
| Item | Description |
|---|---|
| EACCES | Search access if denied. |
| EBADF | The file referred to by Fildes is not an open file descriptor. |
| ENOTDIR | The open file descriptor does not refer to a directory. |