stdlib.h,string.h,wchar.h的函数列表(cplusplus.com就有,很清楚)goodx

Multibyte characters

mblen
Get length of multibyte character (function )
mbtowc
Convert multibyte sequence to wide character (function )
wctomb
Convert wide character to multibyte sequence (function )

Multibyte strings

mbstowcs
Convert multibyte string to wide-character string (function )
wcstombs
Convert wide-character string to multibyte string (function )

http://www.cplusplus.com/reference/cstdlib/

/* wcrtomb example */
#include <wchar.h>
#include <stdio.h>
#include <stdlib.h> int main() {
const wchar_t* pt = L"wcrtomb example";
char buffer [MB_CUR_MAX];
size_t length, i;
mbstate_t mbs; mbrlen (NULL,,&mbs); /* initialize mbs */ while (*pt) {
length = wcrtomb(buffer,*pt,&mbs);
if ((length==)||(length>MB_CUR_MAX)) break;
putchar ('[');
for (i=;i<length;++i) putchar (buffer[i]);
putchar (']');
++pt;
} return ;
}

http://www.cplusplus.com/reference/cwchar/wcrtomb/

上一篇:maven项目如何手动打包


下一篇:配置apue的头文件apue.h和unp的头文件anp.h