GETCWD(3C) DOMAIN/IX 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
A successful call returns a non-negative pointer. A failed
call returns NULL and sets errno to indicate the error.
RELATED INFORMATION
pwd(1), malloc(3C)
Printed 12/4/86 GETCWD-1