C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
_getcwd, _getdcwd
 Summary Example                         Up Contents Index Back
─────Run-Time Library───────────────────────────────────────────────────────
 
     The _getcwd function gets the full path name of the current
     working directory and stores it at <buffer>. The _getdcwd
     function gets the full path name of the current working directory
     on the specified <drive> and stores it at <buffer>.
 
     Note that both _getcwd and _getdcwd return a string that
     represents the path name of the current working directory. If the
     current working directory is set to the root, the string will end
     with a backslash (\). If the current working directory is set
     to a directory other than the root, the string will end with the
     name of the directory and not with a backslash.
 
     For _getdcwd, the <drive> argument specifies the drive
     (0=default drive, 1=A, 2=B, etc.).
 
     The integer argument <maxlen> specifies the maximum length for the
     path name. An error occurs if the length of the path name
     (including the terminating null character) exceeds <maxlen>. The
     constant _MAX_PATH, defined in STDLIB.H, specifies the maximum
     possible path length.
 
     The <buffer> argument can be NULL; a buffer of at least size
     <maxlen> (more only if necessary) will automatically be allocated
     using malloc to store the path name. This buffer can later be
     freed by calling free and passing it the return value of the
     function (a pointer to the allocated buffer).
 
     Return Value
 
     Both the _getcwd and _getdcwd functions return the path (a pointer
     to <buffer>). A NULL return value indicates an error, and errno is
     set to either ENOMEM or ERANGE.
                                    -♦-