user3443063
user3443063

Reputation: 1615

How to convert char16_t to wchar_t to print out with wprintf

I am trying to write a function to convert a const char16_* to a const wchar_t* to use it in wprintf later on:

const wchar_t* wchart_from_char16(const char16_t*) {
   ???
}

int main(){
  const char16_t* my = u"The Text I want to print";
  const wchar_t* ret = wchart_from_char16(my);
  wprintf(L"The Text is is: %ls ", ret);
 }

How can I do this using codecvt ? This needs to work cross platform

Upvotes: 0

Views: 424

Answers (0)

Related Questions