hpux man page for getcwd

Query: getcwd

OS: hpux

Section: 3c

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

getcwd(3C)																getcwd(3C)

NAME
getcwd() - get pathname of current working directory
SYNOPSIS
DESCRIPTION
The function places the absolute pathname of the current working directory in the array pointed to by buf, and returns buf. The value of size must be at least one greater than the length of the pathname to be returned. If buf is a NULL pointer, obtains size bytes of space using (see malloc(3C)). In this case, the pointer returned by can be used as the argument in a subsequent call to (see malloc(3C)). Invoking with buf as a null pointer is not recommended because this functionality may be removed from the HP-UX operating system in a future release.
RETURN VALUE
Upon successful completion, returns a pointer to the current directory pathname. Otherwise, it returns NULL with set if size is not large enough, or if an error occurs in a lower-level function.
ERRORS
fails if any of the following conditions are encountered: The size argument is zero. The size argument is greater than zero, but is smaller than the length of the pathname. The length of the specified pathname exceeds bytes, or the length of a component of the pathname exceeds bytes while is in effect. may fail if any of the following conditions are encountered: Read or search permission is denied for a component of pathname. buf points outside the allocated address space of the process. may not always detect this error. failed to provide size bytes of memory.
EXAMPLES
#include <unistd.h> #include <limits.h> char *cwd; char buf[PATH_MAX+1]; ... if ((cwd = getcwd(buf, PATH_MAX+1)) == NULL) { perror("pwd"); exit(1); } puts(cwd);
AUTHOR
was developed by AT&T.
SEE ALSO
pwd(1), malloc(3C), thread_safety(5).
STANDARDS CONFORMANCE
getcwd(3C)
Related Man Pages
getcwd(3c) - opensolaris
get_current_dir_name(3) - suse
getcwd(3) - suse
getcwd(3) - osf1
getcwd(3) - freebsd
Similar Topics in the Unix Linux Community
getcwd: permission denied error
getcwd problem.
#$ -cwd #what does this mean?
Restrict Max file size
Getcwd