getcwd man page on HP-UX

Man page or keyword search:  
man Server   10987 pages
apropos Keyword Search (all sections)
Output format
HP-UX logo
[printable version]

getcwd(3C)							    getcwd(3C)

NAME
       getcwd() - get pathname of current working directory

SYNOPSIS
DESCRIPTION
       The function places the absolute pathname of the current working direc‐
       tory 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  mal‐
       loc(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)
[top]

List of man pages available for HP-UX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net