Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

getwd - get pathname of current working directory

&pagelevel(4)&pagelevel

Syntax

#include <unistd.h>

char *getwd(char *path_name); 

Description

getwd() determines the absolute pathname of the current working directory of the calling
process and copies it into a string pointed to by the path_name argument.

If the length of the pathname of the current working directory including the null byte is
greater than {PATH_MAX}+1, getwd() will fail and return a null pointer.

Return val.

Pointer to a string


if successful. The string contains the absolute pathname of the current
working directory.

Null pointer

if an error occurs. The string pointed to by path_name contains an error text.

Notes

See also

Portable applications should use the getcwd() function instead of getwd().

getcwd(), unistd.h.