Manual page for GETCWD(3P)
getcwd - (POSIX only) get current working directory pathname
char *getcwd(char *buf, size_t size);
is a POSIX function.
BSD provides this functionality with the
function copies the absolute pathname of the current working directory
to the array pointed to by buf and returns a pointer to the result.
The size argument is the size in bytes of the array.
If buf is NULL, then
allocates an array of char, copies the pathname and returns
a pointer to the array.
Upon successful completion,
returns the bufP argument.
Otherwise, a NULL pointer is returned and errno is set
to indicate the error.
If any of the following conditions occurs, the
function returns a NULL pointer and
sets errno to the corresponding value:
The buf argument is NULL and
fails to allocate an array for the pathname.
The size argument is zero.
The size argument is greater than zero but smaller than the
length of the absolute pathname of the current directory plus 1.
Created by unroff & hp-tools.
© by Hans-Peter Bischof. All Rights Reserved (1997).
Last modified 21/April/97