.TH chdir() "" "" "System Call (libc)"
.PC "Change working directory"
.B "#include <unistd.h>"
\fBchdir(\fIdirectory\^\fB) char *\fIdirectory\^\fB;\fR
.PP
The
.I "working directory"
(or \fIcurrent directory\|\fR)
is the directory from which the search for a file name begins
if a path name does not begin with `/'.
By convention, the working directory has the name \*(Ql.\*(Qr.
.B chdir()
changes the working directory to the directory pointed to by
.IR directory .
This change is in effect until the program exits or calls \fBchdir()\fR again.
.SH "See Also"
.Xr "cd," cd
.Xr "chmod()," chmod
.Xr "chroot()," chroot
.Xr "directory," directory
.Xr "libc," libc
.Xr "unistd.h" unistd.h
.br
\*(PX Standard, \(sc5.2.1
.SH Diagnostics
.B chdir()
returns zero if successful.
It returns \-1 if an error occurred, e.g., that
.I directory
does not exist, is not a directory, or is not searchable.
