COHERENT manpages

This page displays the COHERENT manpage for _getwd() [Get current working directory name].

List of available manpages
Index


_getwd() -- General Function (libc)

Get current working directory name
char *_getwd(pathname)
char *pathname;

The  current  working  directory is  the  directory  from  which file  name
searches  commence when  a path  name  does not  begin with  `/'.  _getwd()
returns  the name  of  the current  working  directory.  It  is useful  for
processes like  spoolers and daemons,  which must generate  full path names
for files.

If  you do  not  have permission  to  search all  levels  of the  directory
hierarchy above the current directory, _getwd() cannot obtain the directory
name for you.

See Also

chdir(),
getcwd(),
libc,
pwd

Diagnostics

_getwd() returns NULL and writes an error message into pathname if an error
occurs, e.g.,  if the  current directory  cannot be found  or if  any other
error occurs.

Notes

_getwd()  is  obsolete,  and  is  included  for reasons  of  compatibility.
Programmers should use the function getcwd() instead.

_getwd()  fails  if  the current  directory  name  is  longer than  MAXPATH
characters (128  characters as defined in  header file <path.h>). The
chunk  of  memory  pointed to  by  pathname  must  be  big enough  to  hold
MAXPATHLEN characters plus a trailing NUL.

If _getwd() fails, the working  directory cannot be restored to its initial
value.

The name  of this function has  been change to _getwd()  to avoid confusion
with  the Berkeley  UNIX function  getwd(), which  has a  different calling
sequence.