chdir
Chdir, short for change directory, is a function used in many operating system interfaces to modify the current working directory of the calling process. It is part of the POSIX standard and is exposed in C libraries as a system or library call; Windows provides a similar function such as _chdir in its C runtime. The primary purpose is to switch the process’s perspective of where relative paths begin.
The typical signature is int chdir(const char *path). On success, it returns 0; on error, it returns
The effect of chdir is confined to the process that invokes it. It changes the process’s own
High-level language wrappers commonly expose chdir-like functionality. For example, Python’s os.chdir() and other languages offer similar