_mbccpy
, _mbccpy_l
將多位元組字元從某個字串複製到另一個字串。 這些函式已有更安全的版本可用,請參閱 _mbccpy_s
、_mbccpy_s_l
。
重要
這個 API 不能用於在 Windows 執行階段中執行的應用程式。 如需詳細資訊,請參閱 CRT functions not supported in Universal Windows Platform apps (通用 Windows 平台應用程式中不支援的 CRT 函式)。
語法
void _mbccpy(
unsigned char *dest,
const unsigned char *src
);
void _mbccpy_l(
unsigned char *dest,
const unsigned char *src,
_locale_t locale
);
參數
dest
複製目的地。
src
要複製的多位元組字元。
locale
要使用的地區設定。
備註
_mbccpy
函式會將一個多位元組字元從 src
複製到 dest
。
這個函式會驗證它的參數。 如果 _mbccpy
傳遞 或src
的 Null 指標dest
,則會叫用無效的參數處理程式,如參數驗證中所述。 如果允許繼續執行,則會將 errno
設定為 EINVAL
。
針對任何地區設定相關行為,_mbccpy
會使用目前的地區設定。 _mbccpy_l
與 _mbccpy
相同,只不過 _mbccpy_l
會針對任何與地區設定相關的行為使用傳入的地區設定。 如需詳細資訊,請參閱 Locale。
安全性提示:使用以 Null 結束的字串。 以 Null 結束的字串不得超過目的緩衝區的大小。 如需詳細資訊,請參閱 Avoiding Buffer Overruns (避免緩衝區滿溢)。 緩衝區滿溢問題是系統攻擊常見的方法,會造成權限無故提高。
根據預設,此函式的全域狀態會限定於應用程式。 若要變更此行為,請參閱 CRT 中的全域狀態。
一般文字常式對應
Tchar.h 常式 | _UNICODE 和 _MBCS 未定義 |
_MBCS 已定義 |
_UNICODE 已定義 |
---|---|---|---|
_tccpy |
巨集或內嵌函式的對應 | _mbccpy |
巨集或內嵌函式的對應 |
_tccpy_l |
n/a | _mbccpy_l |
n/a |
需求
常式 | 必要的標頭 |
---|---|
_mbccpy |
<mbctype.h> |
_mbccpy_l |
<mbctype.h> |
如需相容性詳細資訊,請參閱相容性。