Index of Section 2 Manual Pages

Interix / SUAgetwd.2Interix / SUA

getwd(2)                                                       getwd(2)

  getcwd()

  NAME

    getcwd() - get working directory pathname

  SYNOPSIS

    #include 

    char * getcwd (char *buf, size_t size)

  DESCRIPTION

    The getcwd(2) function 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.

    This routine has traditionally been used by programs to save the name of a
    working directory for the purpose of returning to it. It is a replacement
    for getwd(), which is deprecated for security reasons.

  RETURN VALUES

    Upon successful completion, a pointer to the pathname is returned.
    Otherwise a NULL pointer is returned and the global variable errno is set
    to indicate the error.

    If an error occurs, the contents of buf are not changed.

  ERRORS

    The getcwd(2) function will fail if:

    [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.

  SEE ALSO

    chdir(2)

  USAGE NOTES

    The getcwd function is thread safe.

    The getcwd function is not async-signal safe.


Interix / SUAHosted at SUA Community for Interix, SUA and SFUInterix / SUA