GETCWD(3,L) AIX Technical Reference GETCWD(3,L)
-------------------------------------------------------------------------------
getcwd
PURPOSE
Gets the path name of the current directory.
LIBRARY
Standard C Library (libc.a)
SYNTAX
char *getcwd (buf, size)
char *buf;
int size;
DESCRIPTION
The getcwd subroutine returns a pointer to a string containing the path name of
the current directory. The value of the size parameter must be at least two
greater than the length of the path name to be returned.
If the buf parameter is a NULL pointer, the getcwd subroutine will, using the
malloc subroutine, obtain the number of bytes of free space as specified by the
size parameter. In this case, the pointer returned by the getcwd subroutine
can be used as the parameter in a subsequent call to free.
If the getcwd subroutine fails, NULL is returned and errno is set to indicate
the error. The getcwd subroutine fails if the size parameter is not large
enough or if an error occurs in a lower-level function.
ERROR CONDITIONS
If any of the following conditions occur, the getcwd function returns a value
of NULL and sets errno to the corresponding value:
EINVAL The size argument is less than or equal to 0.
ERANGE The size argument is greater than 0 but smaller than the length of
the path name plus 1.
EACCES Read or search permission was denied for a component of pathname.
ENOMEM Insufficient storage space is available.
RELATED INFORMATION
In this book: "malloc, free, realloc, calloc, valloc, alloca, mallopt,
mallinfo" and "popen, pclose, rpopen."
Processed November 7, 1990 GETCWD(3,L) 1
GETCWD(3,L) AIX Technical Reference GETCWD(3,L)
The pwd command in AIX Operating System Commands Reference.
Processed November 7, 1990 GETCWD(3,L) 2