GETCWD(3ast) GETCWD(3ast)

# [NAME](#NAME)

getcwd - return absolute path to current directory

# [SYNOPSIS](#SYNOPSIS)

```
#include <ast.h>
char* getcwd(char* buf, size_t len);
```

# [DESCRIPTION](#DESCRIPTION)

getcwd copies the absolute path name of the current directory info into *buf* of length *len*. The return path may be longer than PATH\_MAX. If *buff == 0* then space is allocated via [*malloc*(3)](/man/os/ksh/malloc.3) and *len* extra characters are reserved after the generated path name. A pointer to the path name is returned, 0 on error.

# [SEE ALSO](#SEE_ALSO)

[pathcd(3)](/man/os/ksh/pathcd.3)

---

Document: getcwd(3ast) from ksh 1.0.10-r36 (Chainguard OS)
Source: https://github.com/ksh93/ksh
