提示:本文代码时在C++的编译器上实现的
#include <iostream>
#include <locale>
using std::wcout;
using std::cout;
using std::endl;
using std::locale;
int main()
{
local loc("chs");
_wsetlocale(LC_ALL, L"chs");
wchar_t wch = 0x5220; //删
char cch = 0x64; //b
wcout . imbue(loc);
wcout << wch << endl;
cout << cch << endl;
wprintf(L"%c\n", wch);
printf("%c\n", cch);
return 0;
}
输出结果:
删
d
删
d
详细介绍可参考(http://www.cnblogs.com/zplutor/archive/2010/11/27/1889227.html)