up | Inhaltsverzeichniss | Kommentar

Manual page for GETCWD(3P)

getcwd - (POSIX only) get current working directory pathname

SYNOPSIS

char *getcwd(char *buf, size_t size);

DESCRIPTION

Getcwd is a POSIX function. BSD provides this functionality with the getwd.3 function.

The getcwd 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 getcwd allocates an array of char, copies the pathname and returns a pointer to the array.

RETURN VALUE

Upon successful completion, getcwd returns the bufP argument. Otherwise, a NULL pointer is returned and errno is set to indicate the error.

ERRORS

If any of the following conditions occurs, the getcwd function returns a NULL pointer and sets errno to the corresponding value:
[EAGAIN]
The buf argument is NULL and getcwd fails to allocate an array for the pathname.
[EINVAL]
The size argument is zero.
[ERANGE]
The size argument is greater than zero but smaller than the length of the absolute pathname of the current directory plus 1.

SEE ALSO

chdir(2), getwd(3)


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97