getcwd

Name

getcwd -- get the pathname of the current working directory

Synopsis

#include <unistd.h>

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

Description

The getcwd() functions shall behave as described in POSIX 1003.1-2008 (ISO/IEC 9945-2009), except as noted below.

Differences

If buf is NULL, memory is allocated for buf. If size is 0, the allocation size will be the size of the pathname +1, else the requested size is allocated.

Changed or Added Errors

EINVAL 

The size argument is 0 and buf is not a null pointer.

ENOENT 

The current working directory has been unlinked.