string s = "おはよう";
wstring ws = FUNCTION(s, ws);
How would i assign the contents of s to ws?
Searched google and used some techniques but they can't assign the exact content. The content is distorted.
string s = "おはよう";
wstring ws = FUNCTION(s, ws);
How would i assign the contents of s to ws?
Searched google and used some techniques but they can't assign the exact content. The content is distorted.
Your question is underspecified. Strictly, that example is a syntax error. However, mbstowcs
is probably what you're looking for.
It is a C function and operates on buffers, so you will need
wchar_t buf[] = new wchar_t[ s.size() ];
size_t num_chars = mbstowcs( buf, s.c_str(), s.size() );
wstring ws( buf, num_chars );
delete[] buf;
string s = "おはよう";
is an error.
You should use wstring directly:
wstring ws = L"おはよう";
Mandatory unicode snowman for kicks: