_UNICODE下CString的不同

       近来发现,函数参数需要const char* 或者 LPCTSTR类型时,可以直接使用CString ,无需任何转换,但并不是所有时候都行,有时程序编译就会报错。

       查MSDN...原来是程序是否支持UNICODE的问题。在UNICODE下CString里每个字符是"16-bit" ,所以带来很大的不一样。

         CString is based on the TCHAR data type. If the symbol _UNICODE is defined for your program, TCHAR is defined as type wchar_t, a 16-bit character type; otherwise, it is defined as char, the normal 8-bit character type. Under Unicode, then, CString objects are composed of 16-bit characters. Without Unicode, they are composed of 8-bit char type.

posted @ 2008-12-29 09:54  freezym  阅读(215)  评论(0)    收藏  举报