getcwd(3) — Subroutines
NAME
getcwd - Gets the pathname of the current directory
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
char ∗getcwd (
char ∗buffer,
size_t size ); System V Compatibility [Digital Only] char ∗getcwd (
char ∗buffer,
int size );
PARAMETERS
bufferPoints to a string space to hold the pathname. If the buffer parameter is a null pointer, the getcwd() function, using the malloc() function, obtains the number of bytes of free space as specified by the size parameter. In this case, the pointer returned by the getcwd() function can be used as the parameter in a subsequent call to the free() function.
sizeSpecifies the length of the string space in bytes. The value of the size parameter must be at least the length of the pathname to be returned plus one byte for the terminating null.
DESCRIPTION
The getcwd() function returns a pointer to a string containing the pathname of the current directory. The getwd() function is called to obtain the pathname.
NOTES
The getcwd() function is supported for multi-threaded applications.
AES Support Level:
Full use
RETURN VALUES
Upon successful completion, the buffer parameter is returned. Otherwise, a null value is returned and errno is set to indicate the error.
ERRORS
If the getcwd() function fails, errno may be set to one of the following values:
[EINVAL]The size parameter is zero.
[ERANGE]The size parameter is greater than zero, but is smaller than the length of the pathname + 1.
[ENOMEM]The requested amount of memory could not be allocated. System V Compatibility [Digital Only]
[EINVAL]The size parameter is less than or equal to zero.