Boost logo

Boost Users :

From: Kamil Zubair (kamilzubair_at_[hidden])
Date: 2008-06-18 23:45:39


since char is convertible to wchar_t and vice versa (with a possibility for lost precision of course) I usually just do this:

string s("something");
wstring ws(s.begin(), s.end());

You can do the reverse with wstring to string and as long your wstring doesn't contain non-ASCII characters it should be okay.

--- On Wed, 6/18/08, Hansi <hansipet_at_[hidden]> wrote:
From: Hansi <hansipet_at_[hidden]>
Subject: [Boost-users] convert std::string to std::wstring
To: boost-users_at_[hidden]
Date: Wednesday, June 18, 2008, 2:10 PM

Hello,

I have searched a lot in every place what is the best way to convert a
string to a wstring (and may be vice versa). But til now I don`t got any
results. Can anyone give me an hint what is the best way to do that
(also good performance?)? maybe there is something available to do that?
may be also with some examples.

Thanks
Hansjörg

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net