chdir(2) CLIX chdir(2)
NAME
chdir - Changes the current directory
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
int chdir(
char *path );
PARAMETERS
path Points to the pathname of the directory.
DESCRIPTION
The chdir() function changes the current directory to the directory
indicated by the path parameter.
The current directory, also called the current working directory, is the
starting point of searches for pathnames that do not begin with a slash
(/).
EXAMPLES
To change the current directory to /usr/bin:
if (chdir("/usr/bin"))
perror("Could not chdir to /usr/bin");
RETURN VALUES
Upon successful completion, chdir() returns a value of 0. If chdir()
fails, a value of -1 is returned and the global variable errno is set to
identify the error.
ERRORS
The chdir() function fails and the current directory remains unchanged if
one or more of the following are true:
[EACCES]
Search access is denied for any component of the pathname.
[ENOENT]
The named directory does not exist.
2/94 - Intergraph Corporation 1
chdir(2) CLIX chdir(2)
[ENOTDIR]
A component of the pathname is not a directory.
[ENAMETOOLONG]
The path parameter exceeds PATH_MAX in length, or a pathname
component is longer than NAME_MAX while _POSIX_NO_TRUNC is in
effect.
[EFAULT]
The path parameter points outside the allocated address space of
the process.
[EINTR]
A signal was caught during the chdir() call.
[ENOLINK]
The path parameter points to a remote machine and the link to that
machine is no longer active.
[EMULTIHOP]
Components of path require hopping to multiple remote machines.
RELATED INFORMATION
Functions: chroot(2)
Commands: cd(1), pwd(1)
2 Intergraph Corporation - 2/94