Last active
September 6, 2017 19:24
-
-
Save haleyjd/f2abbc55fa8d30fa6168b938f5048305 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wchar_t *print_as_wide(const char* mbstr) | |
{ | |
mbstate_t state = mbstate_t(); | |
size_t len = 1 + mbsrtowcs(NULL, &mbstr, 0, &state); | |
wchar_t *wstr = new wchar_t [len]; | |
mbsrtowcs(&wstr[0], &mbstr, len, &state); | |
wstr[len-1] = 0; | |
return wstr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment