_getcwd_dbg _wgetcwd_dbg

偵錯版本的_getcwd _wgetcwd函式 (僅可在偵錯期間)。

char *_getcwd_dbg( 
   char *buffer,
   int maxlen,
   int blockType,
   const char *filename,
   int linenumber 
);
wchar_t *_wgetcwd_dbg( 
   wchar_t *buffer,
   int maxlen,
   int blockType,
   const char *filename,
   int linenumber 
);

參數

  • buffer
    路徑的儲存位置。

  • maxlen
    以字元為單位路徑最大長度: char的_getcwd_dbg和wchar_t的_wgetcwd_dbg。

  • blockType
    要求的記憶體區塊類型: _CLIENT_BLOCK或_NORMAL_BLOCK。

  • filename
    要求配置作業的原始程式檔名稱的指標或NULL。

  • linenumber
    對齊配置操作所要求的原始程式檔中的數字或NULL。

傳回值

變數的指標,會傳回buffer。A NULL傳回值會指示發生錯誤,和errno設定其中一個為ENOMEM,表示已配置的記憶體不足,無法maxlen位元組 (時NULL以給定引數buffer),或者ERANGE,指出路徑長度超過maxlen字元。

如需詳細資訊,請參閱 errno、 _doserrno、 _sys_errlist 和 _sys_nerr

備註

_getcwd_dbg和_wgetcwd_dbg函式是等於_getcwd和_wgetcwd差異在於,當 _DEBUG是定義,這些函式使用的偵錯版本malloc和_malloc_dbg配置記憶體,如果NULL的第一個參數傳遞。如需詳細資訊,請參閱 _malloc_dbg

您不需要明確地呼叫這些函式,在大多數情況下。相反地,您可以定義_CRTDBG_MAP_ALLOC旗標。When _CRTDBG_MAP_ALLOC is defined, calls to _getcwdand _wgetcwdare remapped to _getcwd_dbgand _wgetcwd_dbg, respectively, with the blockType set to _NORMAL_BLOCK.因此,您不需要明確地呼叫這些函式,除非您想要標示為堆積區塊_CLIENT_BLOCK。如需詳細資訊,請參閱 偵錯堆積上的區塊類型

泛用文字常式對應

Tchar.h 常式

_Unicode 之後,未定義的 _MBCS

定義的 _MBCS

定義 _unicode 之後

_tgetcwd_dbg

_getcwd_dbg

_getcwd_dbg

_wgetcwd_dbg

需求

常式

所需的標頭

_getcwd_dbg

<crtdbg.h>

_wgetcwd_dbg

<crtdbg.h>

如需相容性資訊,請參閱相容性在簡介中。

.NET Framework 對等用法

CurrentDirectory

請參閱

參考

_getcwd _wgetcwd

目錄控制項

概念

堆積配置函式的偵錯版本