不想使用WideCharToMultiByte和MultiByteToWideChar这两个API对ansi与unicode字符串进行转换
还好发现有%S(s为大写)
ANSI -----> UNICODE
swprintf_s(UnicodeStr, SizeOfUnicodeStr, L"%S", AnsiStr) ;
UNICODE -----> ANSI
sprintf_s(AnsiStr, SizeofAnsiStr, L"%S", UnicodeStr) ;
_tsetlocale(LC_ALL, TEXT("chs")) ;
char ansi[] = "你好 世界" ;
wchar_t unicode[100] ;
swprintf_s(unicode, 100, L"%S", ansi) ;
std::wcout << unicode << std::endl ;
//
wchar_t unicode1[] = L"你好 世界" ;
char ansi1[100] ;
sprintf_s(ansi1, 100, "%S", unicode1) ;
std::cout << ansi1 << std::endl ;
system("pause") ;