Manual Page Result
0
Command: getcwd | Section: 3 | Source: Digital UNIX | File: getcwd.3.gz
getcwd(3) Library Functions Manual getcwd(3)
NAME
getcwd - Gets the pathname of the current directory
LIBRARY
Standard C Library (libc.so, libc.a) System V Compatibility Library
(libsys5.a)
SYNOPSIS
Standard C Library:
#include <unistd.h>
char *getcwd( char *buffer, size_t size);
System V Compatibility Library:
char *getcwd( char *buffer, int size);
STANDARDS
Interfaces documented on this reference page conform to industry stan-
dards as follows:
getcwd() - libc version: XPG4, XPG4-UNIX
Refer to the standards(5) reference page for more information about in-
dustry standards and associated tags.
PARAMETERS
Points to a string space to hold the pathname. Specifies 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 ab-
solute pathname of the current directory. The getwd() function is
called to obtain the pathname.
[Digital] If the buffer parameter is a null pointer, the getcwd() func-
tion, 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.
NOTES
[Digital] The getcwd() function is supported for multithreaded appli-
cations.
RETURN VALUES
Upon successful completion, getcwd() returns the buffer parameter.
Otherwise, a null value is returned and errno is set to indicate the
error.
ERRORS
The getcwd() function sets errno to the specified values for the fol-
lowing conditions: Read or search permission was denied for a component
of the pathname. The size parameter is zero.
[Digital] The size parameter is less than or equal to zero (for
the libsys5 version of getcwd() only). The size parameter is
greater than zero, but is smaller than the length of the path-
name + 1. The requested amount of memory could not be allo-
cated.
RELATED INFORMATION
Functions: malloc(3), getwd(3)
Standards: standards(5) delim off
getcwd(3)