| ![[Previous]](../prev.gif) | ![[Contents]](../contents.gif) | ![[Index]](../keyword_index.gif) | ![[Next]](../next.gif) | 
Get current working directory pathname
#include <unistd.h> char* getwd( char *path_name );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
|  | This function is in libc.a, but not in libc.so (in order to save space). | 
The getwd() function determines the absolute pathname of the current working directory of the calling process, and copies that pathname into the array pointed to by the path_name argument.
If the length of the pathname of the current working directory is greater than ({PATH_MAX} + 1) including the null byte, getwd() fails and returns a null pointer.
A pointer to the string containing the absolute pathname of the current working directory. On error, getwd() returns a null pointer and the contents of the array pointed to by path_name are undefined.
| Safety: | |
|---|---|
| Cancellation point | Yes | 
| Interrupt handler | No | 
| Signal handler | Yes | 
| Thread | Yes | 
| ![[Previous]](../prev.gif) | ![[Contents]](../contents.gif) | ![[Index]](../keyword_index.gif) | ![[Next]](../next.gif) |