首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

Socket发送字符串有关问题

2012-09-17 
Socket发送字符串问题MFC 中 Socket发送字符串的时候,想全部统一成UTF-8编码请教一下,如何将VS2010中的CSt

Socket发送字符串问题
MFC 中 Socket发送字符串的时候,想全部统一成UTF-8编码
请教一下,如何将VS2010中的CString类型转换为UTF-8编码的字串了,还有就是如何在将UTF-8转换为CString类型了

[解决办法]
WideCharToMultiByte
The WideCharToMultiByte function maps a wide-character string to a new character string. The new character string is not necessarily from a multibyte character set. 

int WideCharToMultiByte(
UINT CodePage, // code page
DWORD dwFlags, // performance and mapping flags
LPCWSTR lpWideCharStr, // wide-character string
int cchWideChar, // number of chars in string
LPSTR lpMultiByteStr, // buffer for new string
int cbMultiByte, // size of buffer
LPCSTR lpDefaultChar, // default for unmappable chars
LPBOOL lpUsedDefaultChar // set when default char used
);

热点排行