lundi 5 octobre 2020

converting string to char * fails (codecvt)

ALL,

Have the following code:

std::wstring my_string = L"foo";
std::wstring_convert<std::codecvt_utf8<wchar_t> > my_conv
const char *chars = my_conv.to_bytes( my_string );

The conversion return an empty pointer (NOT NULL - just "").

Is to_bytes return a temporary pointer? How do I write this code properly?

TIA!!

Aucun commentaire:

Enregistrer un commentaire