getcwd

Returns the current working directory of the current thread group

Local Servers:either blocking or nonblocking
Remote Servers:blocking
Classification:POSIX
Platform:NLM
Service:File System

Syntax

   #include <unistd.h> 
    
   char *getcwd  (  
      char    *buffer,   
      size_t   size); 
   

Parameters

buffer

(OUT) Specifies the buffer in which to place the current working directory.

size

(IN) Specifies the length of buffer (including space for the delimiting \0 character).

Return Values

Returns the address of the string containing the name of the current working directory if successful. Otherwise, NULL is returned and errno is set.

Remarks

When the buffer parameter is NULL, a string is allocated to contain the current working directory. This string must be freed (by calling the free function) or NetWare will issue a leaked memeory error at unload time.

Blocking Information Locally, getcwd blocks when the buffer parameter is NULL and does not block when the buffer parameter is not NULL.

See Also

chdir, free, mkdir, rmdir