GETCWD(3C) DOMAIN/IX Reference Manual (SYS5) GETCWD(3C)
NAME
getcwd - get pathname of current working directory
USAGE
char *getcwd (buf, size)
char *buf;
int size;
DESCRIPTION
Getcwd returns a pointer to the current directory pathname.
The value of size must be at least two characters larger
than the length of the pathname that the function returns.
If buf is a NULL pointer, getcwd will obtain size bytes of
space using malloc(3C). In this case, the pointer returned
by getcwd can be used as the argument in a subsequent call
to free.
EXAMPLE
char *cwd, *getcwd();
.
.
.
if ((cwd = getcwd((char *)NULL, 64)) == NULL) {
perror(``pwd'');
exit(1);
}
printf(``%s\n'', cwd);
DIAGNOSTICS
Returns NULL with errno set if size is not large enough, or
if an error occurs in a lower-level function.
RELATED INFORMATION
pwd(1), malloc(3C)
Printed 5/10/85 GETCWD-1