DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

getwd(S)


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, then getwd fails and returns a NULL pointer. (See limits(F) for a description of PATH_MAX.)

Return value

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.

Compatibility

For portability to earlier implementations of the UNIX® system, getcwd(S) is preferred over this function.

References

getcwd(S)

Standards conformance

This routine conforms to X/Open System Interfaces and Headers, Issue 4, Version 2.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005