The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

getwd - get the 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 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.

 ERRORS

No errors are defined.

 EXAMPLES

None.

 APPLICATION USAGE

For portability to implementations conforming to earlier versions of this specification, getcwd() is preferred over this function.

 FUTURE DIRECTIONS

None.

 SEE ALSO

getcwd(), <unistd.h>.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]