## chdir

#### OS/161 Reference Manual

### Name

chdir - change current directory

### Library

Standard C Library (libc, -lc)

### Synopsis

#include <unistd.h>
int
chdir(const char *pathname);

### Description

The current directory of the current process is set to the directory named by pathname.

### Return Values

On success, chdir returns 0. On error, -1 is returned, and errno is set according to the error encountered.

### Errors

The following error codes should be returned under the conditions given. Other error codes may be returned for other errors not mentioned here.

> ENODEV | The device prefix of pathname did not exist.
> ENOTDIR | A non-final component of pathname was not a directory.
> ENOTDIR | pathname did not refer to a directory.
> ENOENT | pathname did not exist.
> EIO | A hard I/O error occurred.
> EFAULT | pathname was an invalid pointer.