I\'m working on a native extension for a zinc based flash application and I need to convert a const char* to a wstring.
This is my code:
AFAIK this works only from C++11 and above:
#include
// ...
std::wstring stringToWstring(const std::string& t_str)
{
//setup converter
typedef std::codecvt_utf8 convert_type;
std::wstring_convert converter;
//use converter (.to_bytes: wstr->str, .from_bytes: str->wstr)
return converter.from_bytes(t_str);
}
Reference answer