在日本業界標準 (JIS) 和日本 Microsoft (JMS) 字元之間進行轉換。
重要
這個 API 不能用於在 Windows 執行階段中執行的應用程式。 如需詳細資訊,請參閱 CRT functions not supported in Universal Windows Platform apps (通用 Windows 平台應用程式中不支援的 CRT 函式)。
語法
unsigned int _mbcjistojms(
unsigned int c
);
unsigned int _mbcjistojms_l(
unsigned int c,
_locale_t locale
);
unsigned int _mbcjmstojis(
unsigned int c
);
unsigned int _mbcjmstojis_l(
unsigned int c,
_locale_t locale
);
參數
c
要轉換的字元。
locale
要使用的地區設定。
傳回值
在日本地區設定,這些函式會傳回已轉換的字元;如果無法轉換,則傳回 0。 在非日文地區設定,這些函式會傳回傳入的字元。
備註
_mbcjistojms 函式會將日本業界標準 (JIS) 字元轉換成 Microsoft 漢字 (Shift JIS) 字元。 只有當前置和尾端位元組位於範圍0x21 - 0x7E時,才會轉換字元。 如果前導位元組或後隨位元組超出此範圍,errno 會設定為 EILSEQ。 如您需要這個和其他錯誤碼的詳細資訊,請參閱errno、 _doserrno_sys_errlist和 _sys_nerr。
函 _mbcjmstojis 式會將 Shift JIS 字元轉換成 JIS 字元。 只有當前置位元組位於範圍0x81 - 0x9F或0xE0 - 0xFC且尾端位元組位於範圍0x40 - 0x7E或0x80 - 0xFC時,才會轉換字元。 該範圍中的某些程式代碼點沒有指派字元,因此無法轉換。
值 c 應該是 16 位元值,其較高的 8 位元代表要轉換之字元的前導位元組,而其較低的 8 位元代表後隨位元組。
輸出值會受到設定地區設定之 LC_CTYPE 類別設定的影響。 如需詳細資訊,請參閱setlocale。 這些沒有 _l 後置字元的函式版本,會針對此與地區設定相關的行為使用目前的地區設定;具有 _l 後置字元的版本也一樣,只不過它們會改用傳遞的地區設定參數。 如需詳細資訊,請參閱 Locale。
在舊版中, _mbcjistojms 和 _mbcjmstojis 分別呼叫 jistojms 和 jmstojis。 _mbcjistojms應該改用、 _mbcjistojms_l_mbcjmstojis 與 _mbcjmstojis_l 。
根據預設,此函式的全域狀態會限定於應用程式。 若要變更此行為,請參閱 CRT 中的全域狀態。
需求
| 常式 | 必要的標頭 |
|---|---|
_mbcjistojms |
<mbstring.h> |
_mbcjistojms_l |
<mbstring.h> |
_mbcjmstojis |
<mbstring.h> |
_mbcjmstojis_l |
<mbstring.h> |
如需相容性詳細資訊,請參閱相容性。