The getcwd() function places an absolute pathname of the current working directory
in the array pointed to by buf, and returns buf. The size argument is the size in bytes of the character array pointed to by buf and must be at least one greater than the length of the pathname to be returned.
If buf is not a null pointer, the pathname is stored in the space pointed to by buf.
If buf is a null pointer, getcwd() obtains size bytes of space using malloc(3C). The pointer returned by getcwd() can be used as the argument in a subsequent call to free().
|