將字串指標往前移 n 個字元。
重要
在 Windows 執行階段中執行的應用程式中無法使用 _mbsninc 和 _mbsninc_l。 如需詳細資訊,請參閱 CRT functions not supported in Universal Windows Platform apps (通用 Windows 平台應用程式中不支援的 CRT 函式)。
語法
char *_strninc(
const char *str,
size_t count
);
wchar_t *_wcsninc(
const wchar_t *str,
size_t count
);
unsigned char *_mbsninc(
const unsigned char *str,
size_t count
);
unsigned char *_mbsninc(
const unsigned char *str,
size_t count,
_locale_t locale
);
參數
str
來源字串。
count
字串指標要遞增的字元數。
locale
要使用的地區設定。
傳回值
如果提供的指標是 NULL,在 str 遞增 count 個字元或 NULL 之後,所有這些常式都會傳回 str 的指標。 如果 count 大於或等於 str 中的字元數,則結果未定義。
備註
_mbsninc 函式依 count 個多位元組字元遞增 str。 _mbsninc 根據目前使用的多位元組字碼頁來辨識多位元組字元序列。
根據預設,此函式的全域狀態會限定於應用程式。 若要變更此行為,請參閱 CRT 中的全域狀態。
一般文字常式對應
| Tchar.h 常式 | _UNICODE 和 _MBCS 未定義 |
_MBCS 已定義 |
_UNICODE 已定義 |
|---|---|---|---|
_tcsninc |
_strninc |
_mbsninc |
_wcsninc |
_strninc 和 _wcsninc 是的單一位元組字元字串和寬字元字串版本 _mbsninc。 _wcsninc 和 _strninc 僅針對此對應提供,否則不應使用。 如需詳細資訊,請參閱 使用泛型文字對應 和 泛型文字對應。
_mbsninc_l 也相同,但是它會改用傳入的地區設定參數。 如需詳細資訊,請參閱 Locale。
需求
| 常式 | 必要的標頭 |
|---|---|
_mbsninc |
<mbstring.h> |
_mbsninc_l |
<mbstring.h> |
_strninc |
<tchar.h> |
_wcsninc |
<tchar.h> |
如需相容性詳細資訊,請參閱相容性。
另請參閱
字串操作
地區設定
多位元組字元序列的解譯
_strdec、 、 _wcsdec、 _mbsdec_mbsdec_l
_strinc、 、 _wcsinc、 _mbsinc_mbsinc_l
_strnextc、 、 _wcsnextc、 _mbsnextc_mbsnextc_l