Gets the path name of the current directory.
#include <unistd.h>
char *getcwd ( Buffer, Size)
char *Buffer;
size_t Size;
The getcwd subroutine places the absolute path name of the current working directory in the array pointed to by the Buffer parameter, and returns that path name. The size parameter specifies the size in bytes of the character array pointed to by the Buffer parameter.
Size | Specifies the length of the string space. The value of the Size parameter must be at least 1 greater than the length of the path name to be returned. |
If the getcwd subroutine is unsuccessful, a null value is returned and the errno global variable is set to indicate the error. The getcwd subroutine is unsuccessful if the Size parameter is not large enough or if an error occurs in a lower-level function.
If the getcwd subroutine
is unsuccessful, it returns one or more of the following error codes:
This subroutine is part of Base Operating System (BOS) Runtime.
The getwd (getwd Subroutine) subroutine, malloc (malloc, free, realloc, calloc, mallopt, mallinfo, alloca, or valloc Subroutine) subroutine.
Files, Directories, and File Systems for Programmers in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.