Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getcwd(3) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

malloc, free, realloc, calloc

popen, pclose

pwd

     getcwd

Purpose

     Gets the path name of the current directory.

Library

     Standard C Library (libc.a)

Syntax

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

Description

     The getcwd subroutine returns a  pointer to a string con-
     taining  the path  name  of the  current directory.   The
     value of the size parameter  must be at least two greater
     than the length of the path name to be returned.

     If the buf  parameter is a NULL pointer,  the getcwd sub-
     routine  will, using  the malloc  subroutine, obtain  the
     number of  bytes of free  space as specified by  the size
     parameter.   In this  case, the  pointer returned  by the
     getcwd subroutine can be used  as the parameter in a sub-
     sequent call to free.

     If  the getcwd  subroutine  fails, NULL  is returned  and
     errno is set  to indicate the error.   The getcwd subrou-
     tine fails if  the size parameter is not  large enough or
     if an error occurs in a lower-level function.

Related Information

     In  this  book:   "malloc,  free,  realloc,  calloc"  and
     "popen, pclose."

     The pwd  command in AIX Operating  System Commands Refer-
     ence.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026