码迷,mamicode.com
首页 > 其他好文 > 详细

辅助开发模块

时间:2017-01-14 18:22:12      阅读:125      评论:0      收藏:0      [点我收藏+]

标签:ring   str   har   ide   pst   win32   开发   new   字符   

//GKB 转换UTF8

//-----------------------------字符转换----------------------------------------------------------------------
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
std::string Win32GBKToUTF8(c_char* pStr)
{
std::string str = pStr;
std::string strOutUTF8 = "";
WCHAR * str1;
int n = MultiByteToWideChar(CP_ACP, 0, pStr, -1, NULL, 0);
str1 = new WCHAR[n];
MultiByteToWideChar(CP_ACP, 0, pStr, -1, str1, n);
n = WideCharToMultiByte(CP_UTF8, 0, str1, -1, NULL, 0, NULL, NULL);
char * str2 = new char[n];
WideCharToMultiByte(CP_UTF8, 0, str1, -1, str2, n, NULL, NULL);
strOutUTF8 = str2;
delete[]str1;
str1 = NULL;
delete[]str2;
str2 = NULL;
return strOutUTF8;
}
#endif
//

辅助开发模块

标签:ring   str   har   ide   pst   win32   开发   new   字符   

原文地址:http://www.cnblogs.com/beibeipan/p/6285825.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!