/sys$common/syshlp/HELPLIB.HLB  —  CRTL  getcwd
    Returns a pointer to the file specification for the current
    working directory.

    Format

      #include  <unistd.h>

      char *getcwd  (char *buffer, size_t size); (ISO POSIX-1)

      char *getcwd  (char *buffer, unsigned int size, . . . );
                      (DEC C Extension)

1  –  Function Variants

    The getcwd function has variants named _getcwd32 and _getcwd64
    for use with 32-bit and 64-bit pointer sizes, respectively.

2  –  Arguments

 buffer

    Pointer to a character string large enough to hold the directory
    specification.

    If buffer is a NULL pointer, getcwd obtains size bytes of space
    using malloc. In this case, you can use the pointer returned by
    getcwd as the argument in a subsequent call to free.

 size

    The length of the directory specification to be returned.

  . . .

    An optional argument that can be either 1 or 0. If you specify 1,
    the directory specification is returned in OpenVMS format. If you
    specify 0, the directory specification (pathname) is returned in
    UNIX style format. If you omit this argument, getcwd returns the
    filename according to your current command-language interpreter
    (CLI).

3  –  Return Values

    x                  A pointer to the file specification.
    NULL               Indicates an error.
Close Help