二十五岁时我们都一样愚蠢、多愁善感,喜欢故弄玄虚,可如果不那样的话,五十岁时也就不会如此明智。
标题:C库函数 - wctomb()
C库函数 - wctomb()
#include <stdio.h> #include <stdlib.h> int main () { int i; wchar_t wc = L'a'; char *pmbnull = NULL; char *pmb = (char *)malloc(sizeof( char )); printf("Converting wide character:\n"); i = wctomb( pmb, wc ); printf("Characters converted: %u\n", i); printf("Multibyte character: %.1s\n", pmb); printf("Trying to convert when target is NULL:\n"); i = wctomb( pmbnull, wc ); printf("Characters converted: %u\n", i); /* this will not print any value */ printf("Multibyte character: %.1s\n", pmbnull); return(0); }