2. wchar_t与wstring
2.1. 测试源代码
void wchar_wstring()
{
// wchar_t字符
std::wcout << "wchar_t size: " << sizeof(wchar_t) << std::endl;
wchar_t ch_arr1[] = L"ABC";
std::wcout << "ch_arr1 size: " << sizeof(ch_arr1) << ", strlen:" << wcslen(ch_arr1)
<< ", str:" << ch_arr1 << ", bytes:";
for (auto ch : ch_arr1)
{
std::wcout << std::hex << std::uppercase << (int)ch << " ";
}
std::wcout << std::endl;
wchar_t ch_arr2[] = L"中国𪚥Ω";
std::wcout << std::dec << "ch_arr2 size: " << sizeof(ch_arr2) << ", strlen:" << wcsle