Visit Our UNIX and Linux User Community

Linux and UNIX Man Pages

Test Your Knowledge in Computers #74
Difficulty: Easy
NeXTStep was based on the original BSD operating system.
True or False?
Linux & Unix Commands - Search Man Pages

getwd(3) [osf1 man page]

getwd(3)						     Library Functions Manual							  getwd(3)

NAME
getwd - Gets current directory pathname LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <unistd.h> char *getwd( char *path_name); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: getwd(): XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Points to the full pathname. DESCRIPTION
The getwd() function determines the absolute pathname of the current directory, then copies that pathname into the array pointed to by the path_name parameter. The maximum pathname length, in characters, is set by the PATH_MAX definition, as specified in the limits.h file. If the length of the pathname of the current 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 absolute pathname of the current directory is returned. If an error occurs, the getwd() func- tion returns a null pointer. and places a message in the path_name parameter. RELATED INFORMATION
Functions: getcwd(3) Standards: standards(5) delim off getwd(3)

Check Out this Related Man Page

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. Other- wise, getwd() returns a null pointer and the contents of the array pointed to by path_name are undefined. ERRORS
No errors are defined. USAGE
For portability to implementations conforming to versions of the X/Open Portability Guide prior to SUS, getcwd(3C) is preferred over this function. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ |ATTRIBUTE TYPE |ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
getcwd(3C), attributes(5), standards(5) SunOS 5.11 24 Jul 2002 getwd(3C)

Featured Tech Videos