共用方式為


_strdec、_wcsdec、_mbsdec、_mbsdec_l

移動資料指標向後一個字元。

重要

mbsdec 和 mbsdec_l 不能用於 Windows 執行階段執行的應用程式。如需詳細資訊,請參閱 CRT 函式不支援使用 /ZW

unsigned char *_strdec(
   const unsigned char *start,
   const unsigned char *current 
);
unsigned wchar_t *_wcsdec(
   const unsigned wchar_t *start,
   const unsigned wchar_t *current 
);
unsigned char *_mbsdec(
   const unsigned char *start,
   const unsigned char *current 
);
unsigned char *_mbsdec_l(
   const unsigned char *start,
   const unsigned char *current,
   _locale_t locale
);

參數

  • start
    對任何字元的指標 ( _mbsdec ) 和mbsdec_l,第一個位元組的任何多位元組字元) 在來源字串; start 必須在來源字串的 current 之前。

  • current
    對任何字元的指標 ( _mbsdec ) 和mbsdec_l,第一個位元組的任何多位元組字元) 在來源字串; current 必須依照來源字串的 start 。

  • locale
    使用的地區設定。

傳回值

_mbsdec, _mbsdec_l、 _strdec和 _wcsdec 都會傳回指標緊接在 current前面的字元;,如果 start 的值大於或等於 current, _mbsdec 會傳回 NULL 。 _tcsdec 對應到這些函式之一,而它的傳回值取決於對應。

備註

_mbsdec 和 _mbsdec_l 函式會傳回指標緊接在該字串的 current 之前包含 start多位元組字元的第一個位元組。

輸出值受地區設定的 LC_CTYPE 類別設定的設定所影響;請參閱 setlocale _wsetlocale 以取得詳細資訊。 _mbsdec 表示根據目前使用的地區設定識別多位元組字元序列,,而 _mbsdec_l 相同,但是使用傳遞的地區設定參數。 如需詳細資訊,請參閱地區設定

如果 start 或 current 是 NULL,不正確的參數叫用處理常式,如 參數驗證中所述。 如果執行允許繼續,這個函式會傳回 EINVAL 和 errno 設為 EINVAL。

安全性注意事項安全性提示

這些函式可能有弱點的緩衝區滿溢威脅。因為它們可能會導致權限的不確定的攻擊,緩衝區滿溢可以為系統攻擊使用。如需詳細資訊,請參閱 Avoiding Buffer Overruns

泛用文字常式對應

Tchar.h 常式

未定義的 _UNICODE 和 _MBCS

已定義 _MBCS

已定義 _UNICODE

_tcsdec

_strdec

_mbsdec

_wcsdec

_strdec 和 _wcsdec 都是 _mbsdec 單一位元組字元和寬字元版本和 _mbsdec_l。 _strdec 和 _wcsdec 為這種對應只提供,而且不應該為使用。

如需詳細資訊,請參閱使用泛用文字對應泛用文字對應

需求

程序

必要的標頭檔

選擇性標頭

_mbsdec

<mbstring.h>

<mbctype.h>

_mbsdec_l

<mbstring.h>

<mbctype.h>

_strdec

<tchar.h>

 

_wcsdec

<tchar.h>

 

如需相容性詳細資訊,請參閱 相容性

範例

下列範例會示範 _tcsdec的用法。

#include <iostream>
#include <tchar.h>
using namespace std;

int main()
{
   const TCHAR *str = _T("12345");
   cout << "str: " << str << endl;

   const TCHAR *str2;
   str2 = str + 2;
   cout << "str2: " << str2 << endl;

   TCHAR *answer;
   answer = _tcsdec( str, str2 );
   cout << "answer: " << answer << endl;

   return (0); 
}

下列範例會示範 _mbsdec的用法。

#include <iostream>
#include <mbstring.h>
using namespace std;

int main() 
{ 
   char *str = "12345";
   cout << "str: " << str << endl;

   char *str2;
   str2 = str + 2; 
   cout << "str2: " << str2 << endl;

   unsigned char *answer;
   answer = _mbsdec( reinterpret_cast<unsigned char *>( str ), reinterpret_cast<unsigned char *>( str2 ));

   cout << "answer: " << answer << endl;

   return (0); 
}

.NET Framework 對等用法

不適用。若要呼叫標準 C 函式,請使用 PInvoke。如需詳細資訊,請參閱平台叫用範例

請參閱

參考

字串操作 (CRT)

_strinc、_wcsinc、_mbsinc、_mbsinc_l

_strnextc、_wcsnextc、_mbsnextc、_mbsnextc_l

_strninc、_wcsninc、_mbsninc、_mbsninc_l