chdir(S) 6 January 1993 chdir(S) Name chdir - change working directory Syntax cc . . . -lc int chdir (path) char *path; Description path points to the pathname of a directory. chdir causes the named directory to become the current working directory, the starting point for path searches for pathnames not beginning with /. chdir fails and the current working directory is unchanged if one or more of the following is true: [EACCES] Search permission is denied for any component of the pathname. [EFAULT] path points outside the allocated address space of the process. [EINTR] A signal was caught during the chdir system call. [EMULTIHOP] Components of path require hopping to multiple remote ma- chines. [ENOENT] The named directory does not exist. [ENOLINK] path points to a remote machine and the link to that ma- chine is no longer active. [ENOTDIR] A component of the pathname is not a directory. See also chroot(S) Diagnostics Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error. Standards conformance chdir is conformant with: AT&T SVID Issue 2; X/Open Portability Guide, Issue 3, 1989; Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2); IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1); and NIST FIPS 151-1.