converting narrow string to wide string

前端 未结 9 1510
难免孤独
难免孤独 2020-12-06 11:57

How can i convert a narrow string to a wide string ?

I have tried this method :

string myName;
getline( cin , myName );
wst         


        
9条回答
  •  不知归路
    2020-12-06 12:45

    If the source is ASCII encoded, you can just do this:

    wstring printerName;
    printerName.assign( myName.begin(), myName.end() );
    

提交回复
热议问题