Blame

fb4ecb Bob Green 2026-08-26 11:46:03
1
% chdir(3) Version 1.0 | Library Functions Manual
2
***
3
4
## NAME
5
6
**chdir** — change working directory
7
8
### LIBRARY
9
10
libmega C library (-lmega)
11
12
### SYNOPSIS
13
14
```
15
#include <unistd.h>
16
17
int chdir(const char *path);
18
```
19
20
### DESCRIPTION
21
changes the current working directory of the calling process to the directory specified in **_path_**.
22
23
### RETURN VALUE
24
On success, zero is returned. On error, -1 is returned, and **_errno_** is set to indicate the error.
25
26
### ERRORS
27
**chdir()** can fail with the following errors:
28
29
* ENOENT - The directory specified in path does not exist.
30
* ENOTDIR - A component of path is not a directory.
31
32
### NOTES
33
34
The current working directory is the starting point for interpreting relative pathnames (those not starting with '/').
35
36
### BUGS
37
38
See GitHub Issues: <https://github.com/znac049/mega-micros-sbc3/issues>
39
40
### AUTHOR
41
42
Bob Green <bob@chippers.org.uk>
43
44
### SEE ALSO
45
**getcwd()**