GETWD(3C) |
Standard C Library Functions |
GETWD(3C) |
NAME
getwd — get current working directory pathname
SYNOPSIS
#include <unistd.h>
char *
getwd(char *path_name);
DESCRIPTION
The
getwd() function determines an absolute pathname of the current working directory of the calling process, and copies that pathname into the array pointed to by the
path_name argument.
If the length of the pathname of the current working directory is greater than (PATH_MAX + 1) including the null byte, getwd() fails and returns a null pointer.
RETURN VALUES
Upon successful completion, a pointer to the string containing the absolute pathname of the current working directory is returned. Otherwise, getwd() returns a null pointer and the contents of the array pointed to by path_name are undefined.
ERRORS
No errors are defined.
USAGE
The
getwd() function is supplied for backwards compatibility. The
getcwd(3C) should be used instead.
INTERFACE STABILITY
Obsolete Standard.
STANDARDS
The
getwd() function is available in the following compilation environments. See
standards(5).
-
X/Open Portability Guide Issue 4, Version 2 (“XPG4.2”)
-
Version 2 of the Single UNIX Specification (“SUSv2”)
-
Version 3 of the Single UNIX Specification (“SUSv3”)
It was marked obsolete in Version 3 of the Single UNIX Specification (“SUSv3”) and removed from IEEE Std 1003.1-2008 (“POSIX.1”).