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

Multibyte characters

 

Multibyte strings

 

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,0,&mbs);   /* initialize mbs */

  while (*pt) {
    length = wcrtomb(buffer,*pt,&mbs);
    if ((length==0)||(length>MB_CUR_MAX)) break;
    putchar ('[');
    for (i=0;i<length;++i) putchar (buffer[i]);
    putchar (']');
    ++pt;
  }

  return 0;
}

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

 

posted @ 2017-02-15 21:39  findumars  Views(306)  Comments(0Edit  收藏  举报