ultrix man page for getcwd

Query: getcwd

OS: ultrix

Section: 3

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

getcwd(3)						     Library Functions Manual							 getcwd(3)

Name
       getcwd - get pathname of working directory

Syntax
       char I**getcwd (buf, size)
       char I**buf;
       int size;

Description
       The  subroutine returns a pointer to the current directory pathname.  The value of size must be at least two greater than the length of the
       pathname to be returned.

       If buf is a NULL pointer, will obtain size bytes of space using In this case, the pointer returned by may be used as the argument in a sub-
       sequent call to free.

       The function is implemented by using to pipe the output of the command into the specified string space.

Examples
       char *cwd, *getcwd();
       .
       .
       .
       if ((cwd = getcwd((char *)NULL, 64)) == NULL) {

	    perror("pwd");
	    exit(1);
       }
       printf("%s
", cwd);

Return Values
       Returns NULL with errno set if size is not large enough, or if an error occurs in a lower-level function.

Diagnostics
       [EINVAL]       The size argument is zero or negative.

       [ERANGE]       The size argument is greater than zero, but is smaller than the length of the pathname+1;

       [EACCES]       Read or search permission is denied for a component of the pathname.

       [ENOMEM]       Insufficient storage space is available.

See Also
       pwd(1), malloc(3), popen(3)

																	 getcwd(3)
Related Man Pages
getcwd(3c) - opensolaris
getcwd(3) - redhat
getcwd(3) - ultrix
getwd(3) - netbsd
getcwd(3c) - hpux
Similar Topics in the Unix Linux Community
getcwd: permission denied error
size of a directory
switching directories in C
getcwd problem.
#$ -cwd #what does this mean?