int wctomb(char* cpMultibyteChar, wchar_t wWideChar);
#include <cstdlib>
#include <cstdio>
int main() {
wchar_t wWideChar = L'X';
char* cpMultibyteChar = new char[2*MB_CUR_MAX];
// Convert to a multibyte char
int iConvertLength = wctomb(cpMultibyteChar, wWideChar);
// Null terminate the chars
cpMultibyteChar[iConvertLength] = 0;
printf("Conversion Length = %d\n", iConvertLength);
printf("Conversion = %s\n", cpMultibyteChar);
delete [] cpMultibyteChar;
// Keep the window open until "Enter" is pressed
getchar();
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.