How to convert wstring into string?

前端 未结 17 2172
北海茫月
北海茫月 2020-11-22 13:10

The question is how to convert wstring to string?

I have next example :

#include 
#include 

int main()
{
    std::wstr         


        
17条回答
  •  日久生厌
    2020-11-22 13:20

    #include 
    namespace lcv = boost::locale::conv;
    
    inline std::wstring fromUTF8(const std::string& s)
    { return lcv::utf_to_utf(s); }
    
    inline std::string toUTF8(const std::wstring& ws)
    { return lcv::utf_to_utf(ws); }
    

提交回复
热议问题