INtime SDK Help
getcwd, _th_getcwd

Retrieves the working directory's pathname.

#include <unistd.h>

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

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

Description

getcwd copies the absolute pathname of the current working directory into the memory referenced by buf and returns a pointer to buf. The size argument is the size, in bytes, of the array referenced by buf.

If buf is NULL, space is allocated as necessary to store the pathname. This space may later be free(3)'d.

_th_getcwd returns the current path for a thread. Getcwd() returns the current path for a process.

Return Values

A pointer to the pathname
Success.
A NULL pointer
Failure. An invalid descriptor sets errno to one of these values:
EINVAL The value of buffer is 0 (zero).
EACESS Read or search permission was denied for a component of the pathname.
EINVAL The size argument is zero.
ENOENT A component of the pathname no longer exists.
ENOMEM Insufficient memory is available.
ERANGE The size argument is greater than zero but smaller than the length of the pathname plus 1.

In addition, getwd() copies the error message associated with errno into the memory referenced by buf.

Requirements

Versions Defined in Include Link to
INtime 3.13 intime/rt/include/direct.h rt.h clib.lib

See Also

_th_chdir, chdir, free, malloc