C++ convert char * to to wide string wstring

Often times when working with older code you find yourself staring at some old char* variables. I often find myself having to convert them to wide strings for unicode support (wstring). I created a handy function that makes this simple.
wstring charToWideString( const char* src )
    return std::wstring( src, src + strlen(src) );
Now simply call thus:
wstring thus = charToWideString( "thus" );
Drop this function in a static class or header file and use it anywhere.


Popular posts from this blog

C# Form Application in Kiosk Mode/Fullscreen

C# using a transaction with ODBC

Notify Icon Text vs BalloonTipText