CHDIR(2)
NAME
chdir − change current working directory
USAGE
chdir(path)
char *path;
DESCRIPTION
Path is the pathname of a directory. Chdir sets this directory as the current working directory, the starting point for pathnames not beginning with the root (/) or tilde (~).
In order for a directory to become the current directory, a process must have execute (search) access to the directory.
RETURN VALUE
Upon successful completion, a value of zero returns. Otherwise, chdir returns −1 and sets errno to indicate the error.
ERRORS
Chdir will fail and the current working directory will not change if one or more of the following are true:
[ENOTDIR] A component of the pathname is not a directory.
[ENOENT] The directory named does not exist.
[ENOENT] The argument pathname is too long.
[EPERM] The argument contains a byte with the high-order bit set.
[EACCES] Search permission is denied for any component of the pathname.
[EFAULT] Path points outside the process’ allocated address space.
[ELOOP] The call encountered too many symbolic links in translating the pathname.