Windows使用两种字符集ANSI和UNICODE,前者就是通常使用的单字节方式,但这种方式处理象中文这样的双字节字符不方便,容易出现半个汉字的情况。而后者是双字节方式,方便处理双字节字符。Windows NT的所有与字符有关的函数都提供两种方式的版本,而Windows 9x只支持ANSI方式。_T一般同字常数相关,如_T("Hello")。如果你编译一个程序为ANSI方式,_T实际不起任何作用。而如果编译一个程序为UNICODE方式,则编译器会把"Hello"字符串以UNICODE方式保存。_T和_L的区别在于,_L不管你是以什么方式编译,一律以以UNICODE方式保存
Data Type Mappings
These data-type mappings are defined in TCHAR.H and depend on whether the constant _UNICODE or _MBCS has been defined in your program.
For related information, see Using TCHAR.H Data Types with _MBCS Code.
Generic-Text Data Type Mappings
Generic-Text
Data Type Name SBCS (_UNICODE,
_MBCS Not
Defined)
_MBCS
Defined
_UNICODE
Defined
_TCHAR char char wchar_t
_TINT int int wint_t
_TSCHAR signed char signed char wchar_t
_TUCHAR unsigned char unsigned char wchar_t
_TXCHAR char unsigned char wchar_t
_T or _TEXT No effect (removed by preprocessor) No effect (removed by preprocessor) L (converts following character or string to its Unicode counterpart)
//////////////////////////////////////////////////
上面是msdn的解释,我见到的,大多是赋值的,如定一个了个char *s=_T("china);
阅读(1069) | 评论(0) | 转发(0) |