The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

NAME


chdir - change working directory

SYNOPSIS

#include <unistd.h>

int chdir(const char *path);

DESCRIPTION

The chdir() function causes the directory named by the pathname pointed to by the path argument to become the current working directory; that is, the starting point for path searches for pathnames not beginning with /.

RETURN VALUE

Upon successful completion, 0 is returned. Otherwise, -1 is returned, the current working directory remains unchanged and errno is set to indicate the error.

ERRORS

The chdir() function will fail if:

[EACCES]
Search permission is denied for any component of the pathname.

[ELOOP]
Too many symbolic links were encountered in resolving path.

[ENAMETOOLONG]

The path argument exceeds {PATH_MAX} in length or a pathname component is longer than {NAME_MAX}.

[ENOENT]
A component of path does not name an existing directory or path is an empty string.

[ENOTDIR]
A component of the pathname is not a directory.

The chdir() function may fail if:

[ENAMETOOLONG]

Pathname resolution of a symbolic link produced an intermediate result whose length exceeds {PATH_MAX}.

EXAMPLES

None.

APPLICATION USAGE

None.

FUTURE DIRECTIONS

None.

SEE ALSO

getcwd(), <unistd.h>.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]