CHDIR(2) SysV CHDIR(2)
NAME
chdir - Change the current directory
SYNOPSIS
int chdir (path )
const char *path;
DESCRIPTION
The chdir function changes the current directory to the directory
indicated by the path argument. If the path argument refers to a symbolic
link, the chdir function sets the current directory to the directory
pointed to by the symbolic link.
The current directory, also called the current working directory, is the
starting point of searches for pathnames that do not begin with a /
(slash).
DIAGNOSTICS
Upon successful completion, the chdir function returns a value of 0
(zero). Otherwise, a value of -1 is returned and errno is set to
indicate the error.
ERRORS
If the chdir function fails, the current directory remains unchanged and
errno is set to one of the following values:
[EACCES] Search access is denied for any component of the pathname.
[ELOOP] Too many symbolic links were encountered in translating the
pathname.
[EFAULT] The path argument points outside the process's allocated
address space.
[ENOENT] The named directory does not exist, or path points to an empty
string.
[ENOTDIR] A component of the path prefix is not a directory.
[ENAMETOOLONG]
The length of the path argument exceeds PATH_MAX or a pathname
component is longer than NAME_MAX.
[EINTR] A signal was caught during the chdir system call.
SEE ALSO
chroot(2) getcwd(3C)
cd(1)