Hello,
I am having problems with string/wstring code. In the code below Buffer returns a string.
This first code works, but I noticed that if the returned string from Buffer contained embedded null characters, it would terminate the string when passed to wstring.
When I thought I fixed the code as shown below, I realized that the first wcout worked, but all subsequent wcouts's did not. Any idea what I did wrong?Code:wstring name = wstring((wchar_t*)Buffer(buf, size).data()); wcout << L"Name: " << name << endl
Code:string sname= Buffer(buf, size); wstring name = wstring((wchar_t*)sname.data(), sname.size()); wcout << L"Name: " << name << endl




Reply With Quote