% getcwd(3) Version 1.0 | Library Functions Manual


NAME

getcwd — get current working directory.

LIBRARY

libmega C library (-lmega)

SYNOPSIS

#include <unistd.h>

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

DESCRIPTION

getcwd() copies the absolute pathname of the current working directory to the array pointed to by buf, which is of length size.

getwd() does not malloc(3) any memory. The buf argument should be a pointer to an array at least PATH_MAX bytes long. If the length of the absolute pathname of the current working directory, including the terminating null byte, exceeds PATH_MAX bytes, NULL is returned, and errno is set to ENAMETOOLONG.

RETURN VALUE

ERRORS

getcwd() can fail with the following errors:

  • ENAMETOOLONG - The size of the null-terminated absolute pathname string exceeds PATH_MAX bytes.
  • ERANGE - The size argument is less than the length of the absolute pathname of the working directory, including the terminating null byte. You need to allocate a bigger array and try again.

NOTES

None.

BUGS

See GitHub Issues: https://github.com/znac049/mega-micros-sbc3/issues

AUTHOR

Bob Green bob@chippers.org.uk

SEE ALSO

**chdir(2), open(2), unlink(2)

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9