We recommend using Visual Studio 2017

_getdcwd_nolock, _wgetdcwd_nolock


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at _getdcwd_nolock, _wgetdcwd_nolock.

Gets the full path of the current working directory on the specified drive.

System_CAPS_ICON_important.jpg Important

This API cannot be used in applications that execute in the Windows Runtime. For more information, see CRT functions not supported with /ZW.

char *_getdcwd_nolock(   
   int drive,  
   char *buffer,  
   int maxlen   
wchar_t *_wgetdcwd_nolock(   
   int drive,  
   wchar_t *buffer,  
   int maxlen   


Disk drive.

Storage location for the path.

Maximum length of path in characters: char for _getdcwd and wchar_t for _wgetdcwd.

See _getdcwd, _wgetdcwd.

_getdcwd_nolock and _wgetdcwd_nolock are identical to _getdcwd and _wgetdcwd, respectively, except that they are not protected from interference by other threads. They might be faster because they do not incur the overhead of locking out other threads. Use these functions only in thread-safe contexts such as single-threaded applications or where the calling scope already handles thread isolation.

Generic-Text Routine Mappings

Tchar.h routine_UNICODE and _MBCS not defined_MBCS defined_UNICODE defined
RoutineRequired header
_wgetdcwd_nolock<direct.h> or <wchar.h>

For more compatibility information, see Compatibility.


Directory Control
_chdir, _wchdir
_getcwd, _wgetcwd
_mkdir, _wmkdir
_rmdir, _wrmdir