国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
c++ string 和wstring 之間的互相轉(zhuǎn)換函數(shù)
http://blog.sina.com.cn/s/blog_5cf500730100e57o.html

#include <string>
std::
string ws2s(const std::wstring& ws)
{
    std::
string curLocale = setlocale(LC_ALL, NULL);        // curLocale "C";
    setlocale(LC_ALL, "chs");
    
const wchar_t* _Source = ws.c_str();
    size_t _Dsize 
= 2 * ws.size() + 1;
    
char *_Dest = new char[_Dsize];
    memset(_Dest,
0,_Dsize);
    wcstombs(_Dest,_Source,_Dsize);
    std::
string result = _Dest;
    delete []_Dest;
    setlocale(LC_ALL, curLocale.c_str());
    
return result;
}

std::wstring s2ws(
const std::string& s)
{
    setlocale(LC_ALL, 
"chs"); 
    
const char* _Source = s.c_str();
    size_t _Dsize 
= s.size() + 1;
    wchar_t 
*_Dest = new wchar_t[_Dsize];
    wmemset(_Dest, 
0_Dsize);
    mbstowcs(_Dest,_Source,_Dsize);
    std::wstring result 
= _Dest;
    delete []_Dest;
    setlocale(LC_ALL, 
"C");
    
return result;
}


( # )


本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
char、wchar_t、string、wstring互相轉(zhuǎn)換
基于jwSMTP的C++發(fā)送Email的Demo
使用 c 和 XAML 開發(fā) UWP 程序
C語(yǔ)言中的匕首-C風(fēng)格字符串(續(xù))
C++實(shí)現(xiàn)CString和string的互相轉(zhuǎn)換(轉(zhuǎn))
移動(dòng)開發(fā)之淺析cocos2d
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服