其实VC中进行Unicode过程如下:
1.为工程添加UNICODE和_UNICODE预处理选项,在VC.net中就是 项目 -> 属性 -> c/c++ -> 预处理器 在/"预
处理定义/"中加入这两个宏定义(vc6中 project -> settings -> c/c++ -> general 中的 Preprocessor
definitions).
2.Include <TCHAR.h>(一般在stdafx.h中)然后把所有使用char*定义变量的地方换为LPTSTR/TCHAR*或
LPCTSTR/const TCHAR*(对应于const char*).
3.把所有的字符串常量用_T()宏包起来,比如 TCHAR* szText = _T(/"我的Text/");
4.STL中的unicode 。c++STL中已经内置了wstring类型代表宽字符串,同样iostream也有wcout、wcin代表宽字符输入输出。因此可以加入以下宏定义:
#ifdef _UNICODE
#define tstring wstring
#define tcout wcout
#define tcin wcin
#else
#define tstring string
#define tcout cout
#define tcin cin
#endif