VC++使用TCHAR

#ifdef _UNICODE
#define tcout wcout
#define tcin wcin
#else
#define tcout cout
#define tcin cin
#endif


//汉字处理
TCHAR buffer[MAXBYTE] = { 0 };
TCHAR* old_locale=_tcsdup(_tsetlocale(LC_ALL,NULL));
_tsetlocale(LC_ALL, _T("chs"));
tcin >> buffer;
_tsetlocale(LC_ALL, old_locale);
free(old_locale);
原文地址:https://www.cnblogs.com/ggzone/p/10121276.html