首页 > 代码库 > C++ string
C++ string
strings
http://msdn.microsoft.com/en-us/library/ms174288.aspx
Example
UTF16 to UTF8 to UTF16 simple CString based conversion
http://www.codeproject.com/Articles/26134/UTF-to-UTF-to-UTF-simple-CString-based-conver
wstring => char*
char* = > wstring
int _tmain(int argc, _TCHAR* argv[]){ /*char sText[20] = { "多字节字符串!OK!" }; //bug; it is bytes DWORD dwNum = MultiByteToWideChar(CP_UTF8, 0, sText, -1, NULL, 0); wchar_t* pwText; pwText = new wchar_t[dwNum]; MultiByteToWideChar(CP_UTF8, 0, sText, -1, pwText, dwNum);*/ wchar_t wText[20] = { L"宽字符转换实例!OK!" }; DWORD dwNum2 = WideCharToMultiByte(CP_UTF8, NULL, wText, -1, NULL, 0, NULL, FALSE); char* psText; psText = new char[dwNum2]; WideCharToMultiByte(CP_UTF8, NULL, wText, -1, psText, dwNum2, NULL, FALSE); DWORD dwNum = MultiByteToWideChar(CP_UTF8, 0, psText, -1, NULL, 0); wchar_t* pwText; pwText = new wchar_t[dwNum]; MultiByteToWideChar(CP_UTF8, 0, psText, -1, pwText, dwNum); return 0;}
C++ string
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。