Retrieves the current working directory of the calling process.
Syntax
DWORD GetCurrentDirectory(
DWORD nBufferLength,
LPTSTR lpBuffer
);
Parameters
| Parameter | Description |
|---|---|
nBufferLength |
The size, in characters, of the buffer pointed to by lpBuffer. |
lpBuffer |
A pointer to a buffer that receives a null-terminated string that specifies the drive and path of the current directory. |
Return Value
lpBuffer, not including the terminating null character. If the buffer pointed to by lpBuffer is not large enough to contain the current directory, the return value is the required buffer size in characters, including the terminating null character.
Remarks
The current working directory is the directory that the process uses for file operations if a full path is not specified.
To get the current directory for a drive other than the current drive, use the GetFullPathName function.
Requirements
| Component | Value |
|---|---|
| Minimum supported client | Windows XP |
| Minimum supported server | Windows Server 2003 |
| Target Platform | Windows |
| Header | Winbase.h (include Windows.h) |
| Library | Kernel32.lib |
| DLL | Kernel32.dll |
See Also