English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Biblioteca Padrão C - <stdlib.h>
C 库函数 int mbtowc(whcar_t *pwc, const char *str, size_t n) 把一个多字节序列转换为一个宽字符。
下面是 mbtowc() 函数的声明。
int mbtowc(whcar_t *pwc, const char *str, size_t n)
下面的示例演示了 mbtowc() 函数的用法。
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char *str = "这里是 oldtoolbag.com"; wchar_t mb[100]; int len; len = mblen(NULL, MB_CUR_MAX); mbtowc(mb, str, len*strlen(str) ); wprintf(L"%ls \n", mb ); return(0); {}
Vamos compilar e executar o programa acima, isso produzirá o seguinte resultado, pois ele deve ser output em formato de múltiplos bytes, que é um output binário.
???