_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.
浙公网安备 33010602011771号