#include <Windows.h> #include <iostream> #include <tchar.h> #include <strsafe.h> #include <fstream> using namespace std; int main() { //wchar_t ch = L'你'; //0x4f60 //wchar_t ch2 = (wchar_t)0x4f60; //setlocale(LC_ALL ,"chs"); wprintf(L"ch = %c/n", ch); //wcout << ch; //cout << endl; wprintf(L"ch2 = %c/n", ch2); //wcout << ch2; //cout << endl; /*wchar_t ch = L'你'; setlocale(LC_ALL ,"chs"); wprintf(L"%c/n", ch);*/ /* CJK统一汉字 4E00 9FBB 20924 CJK统一汉字扩充A 3400 4DB5 6582 CJK统一汉字扩充B 20000 2A6D6 42711 CJK兼容汉字 F900 FA2D 302 CJK兼容汉字 FA30 FA6A 59 CJK兼容汉字 FA70 FAD9 106 CJK兼容汉字补充 2F800 2FA1D 542 */ wofstream out("e://debug.txt"); locale loc("chs"); out.imbue(loc); int nCount = 0; for (int i = 0x4E00; i <= 0x9FBB; ++i) if ((wchar_t)i != L'?') out << (wchar_t)i,nCount++; for (int i = 0x3400; i <= 0x4DB5; ++i) if ((wchar_t)i != L'?') out << (wchar_t)i,nCount++; for (int i = 0x20000; i <= 0x2A6D6; ++i) if ((wchar_t)i != L'?') out << (wchar_t)i,nCount++; for (int i = 0xF900; i <= 0xFA2D; ++i) if ((wchar_t)i != L'?') out << (wchar_t)i,nCount++; for (int i = 0xFA30; i <= 0xFA6A; ++i) if ((wchar_t)i != L'?') out << (wchar_t)i,nCount++; for (int i = 0xFA70; i <= 0xFAD9; ++i) if ((wchar_t)i != L'?') out << (wchar_t)i,nCount++; for (int i = 0x2F800; i <= 0x2FA1D; ++i) if ((wchar_t)i != L'?') out << (wchar_t)i,nCount++; cout << "共有Unicode汉字: " << nCount << endl; return 0; }