int mblen(const char* kcpMultibyteChar, size_t qMaxCount);
#include <iostream>
#include <cstdlib>
int main() {
using namespace std;
char* cpMultibyteChar = new char[MB_CUR_MAX + 1];
wchar_t wWideChar = L'X';
int iMultbyteChars = wctomb(cpMultibyteChar, wWideChar);
int iLength = mblen(cpMultibyteChar, MB_CUR_MAX);
// Add null-terminator
cpMultibyteChar[iLength] = 0;
cout << cpMultibyteChar << endl;
cout << iLength << endl;
cout << iMultbyteChars << endl;
delete [] cpMultibyteChar;
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.