xxxxxxxxxx
string str = DATA_DIR;
std::wstring temp(L"%s",str);
How to convert a std::string to std::wstring using a wstring_converter
xxxxxxxxxx
#include <iostream>
#include <locale>
#include <codecvt>
#include <string>
// Just a normal string
std::string str = "Hello, I'm a string. Nice to meet you!";
// Creating the converter to convert the string
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
// Creating a variable to save the wide string to.
std::wstring wstr = converter.from_bytes(str);
xxxxxxxxxx
int StringToWString(std::wstring &ws, const std::string &s)
{
std::wstring wsTmp(s.begin(), s.end());
ws = wsTmp;
return 0;
}