Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

const char * to std::wstring

std::wstring s2ws(const std::string& str)
{
    int size_needed = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), NULL, 0);
    std::wstring wstrTo( size_needed, 0 );
    MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), &wstrTo[0], size_needed);
    return wstrTo;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #const #char
ADD COMMENT
Topic
Name
6+4 =