VS多字节转Unicode出现的问题
因为软件的需求,需要将程序从多字节字符集转化为Unicode字符集,转换后出现了诸多的问题,除了一些字符需要加上“_T("")”转化外,还有一些转换需要用到函数。
1.不能将参数1 从“char [256]”转换为“LPCWSTR”
需要加上:CA2W()
2. 不能将参数1 从“char ”转换为“LPCWSTR”
加上(LPCWSTR)
3 不能将参数1 从“char ”转换为“LPCWSTR”*
加上(LPCWSTR)
4.不能将参数1 从“char *”转换为“const char ”
加上LPCWSTR()
5.“atof”: 不能将参数1 从“CString”转换为“const char *”
atof改成_tstof
atoi改成_tstoi
6.CString 转 char *
W2A(),A2T()
7.“strncpy”: 不能将参数2 从“CString”转换为“const char *”
strncpy改成memcpy
8.不能将参数2 从“CString”转换为“const char *”
加上CStringA
9.“fopen”: 不能将参数1 从“LPCTSTR”转换为“const char *”
加上CStringA
10.不能将“CString” 转化为“LPARAM”
(LPARAM)(LPCTSTR)
11.不能将参数1 从“char [64]”转换为“const wchar_t *”\
CA2W
12.“strncmp”: 不能将参数2 从“CString”转换为“const char *”
Memcpy
13“open”: 不能将参数1 从“ATL::CStringT<BaseType,StringTraits>”转换为“const char *”
CStringA
14.Wchat_t 转 char*
_bstr_t
或者
USES_CONVERSION;
W2A()