GetCurrentDirectory

  DWORD GetCurrentDirectory(cchCurDir, lpszCurDir)    
  DWORD cchCurDir; /* size of directory buffer in characters */
  LPTSTR lpszCurDir; /* address of buffer for current directory */

The GetCurrentDirectory function retrieves the current directory for the current process.

Parameters

cchCurDir

Specifies the length of the buffer (in characters) for the current directory string. The buffer length should include room for a terminating null character.

lpszCurDir

Points to the buffer for the current directory string. This null-terminated string specifies the absolute path to the current directory.

Return Value

If the function succeeds, the return value specifies the number of characters written to the buffer, not including the terminating null character.

If the lpszCurDir buffer is not large enough, the return value specifies the required size of the buffer, not including the number of bytes necessary for a terminating null character.

If the function fails, the return value is zero.

Comments

The GetCurrentDirectory function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).

See Also

CreateDirectory, GetSystemDirectory, GetWindowsDirectory, RemoveDirectory, SetCurrentDirectory