GETCWD(3C) — HP-UX
NAME
getcwd, gethcwd − get path-name of current working directory
SYNOPSIS
char ∗getcwd (buf, size)
char ∗buf;
int size;
char *gethcwd (buf, size)
char *buf;
int size;
DESCRIPTION
Getcwd returns a pointer to the current directory path-name. The value of size must be at least two greater than the length of the path-name to be returned.
If buf is a NULL pointer, getcwd will obtain size bytes of space using malloc(3C). In this case, the pointer returned by getcwd may be used as the argument in a subsequent call to free (see malloc(3C)).
DIAGNOSTICS
Returns NULL with errno set if size is not large enough, or if an error ocurrs in a lower-level function.
EXAMPLES
char ∗cwd, ∗getcwd();
.
.
.
if ((cwd = getcwd((char ∗)NULL, 64)) == NULL) {
perror("pwd");
exit(1);
}
printf("%s\n", cwd);
DEPENDENCIES
Series 300 Diskless
Gethcwd works the same as getcwd except the returned directory path name will list all hidden directories (context dependent files, see cdf(4)).
AUTHOR
Getcwd was developed by AT&T. Gethcwd was developed by HP.
SEE ALSO
pwd(1), malloc(3C), popen(3S), cdf(4).
Hewlett-Packard Company — Version B.1, May 11, 2021