Answers for "string to wstring"

C++
1

string to wstring

#include <locale>
#include <codecvt>
#include <string>

std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
std::string narrow = converter.to_bytes(wide_utf16_source_string);
std::wstring wide = converter.from_bytes(narrow_utf8_source_string);
Posted by: Guest on July-29-2021

Browse Popular Code Answers by Language