CHDIR(2)CHDIR(2)NAME
chdir - change current working directory
SYNOPSIS
int chdir(const char *path);
DESCRIPTION
The chdir function causes the directory indicated by path to become the
current working directory; that is, the starting point assumed for
pathnames not beginning with ``/''.
If the chdir function fails, the current working directory is left
unchanged.
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, chdir returns a value of 0. Otherwise, a
value of -1 is returned and errno is set to indicate the error.
ERRORS
If any of the following conditions occurs, the chdir function returns
-1 and sets errno to the corresponding value:
[EACCES] Search permission is denied for some component of the
pathname.
[EFAULT] The path argument points outside the process's allocated
address space.
[EINVAL] The pathname contains a character with the high-order
bit set.
[EIO] An I/O error occurred while reading from or writing to
the file system.
[ELOOP] Too many symbolic links were encountered in translating
the pathname.
[ENAMETOOLONG] A component of path exceeds 255 characters, or the
entire pathname exceeds 1023 characters. For POSIX
applications these values are given by the constants
{NAME_MAX} and {PATH_MAX}, respectively.
[ENOENT] The named directory does not exist or path is an empty
string.
[ENOTDIR] A component of is not a directory.
SEE ALSOchroot(2), getwd(3) or getcwd(3P)4th Berkeley Distribution August 1, 1992 CHDIR(2)