chinaunix网友2010-03-27 09:56:18
[code]
#include
#include
#include
#include
#include
using namespace std;
int main()
{
setlocale(LC_ALL, "zh_CN.UTF-8");
const wchar_t wstr[] = L"higklmn中opq国abcdefg";
char ch[4096];
memset(ch, '\0', sizeof(ch));
wcstombs(ch, wstr, sizeof(ch) - 1);
printf("%s\n", ch);
wchar_t wstr2[4096];
memset(wstr2, L'\0', 4096);
mbstowcs(wstr2, ch, 4095);