1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
/* wcstombs example */
#include <stdio.h> /* printf */
#include <stdlib.h> /* wcstombs, wchar_t(C) */
int main() {
const wchar_t str[] = L"wcstombs example";
char buffer[32];
int ret;
printf ("wchar_t string: %ls \n",str);
ret = wcstombs ( buffer, str, sizeof(buffer) );
if (ret==32) buffer[31]='\0';
if (ret) printf ("multibyte string: %s \n",buffer);
return 0;
}
|