Skip to content

Instantly share code, notes, and snippets.

@milesrout
Last active June 9, 2016 05:19
Show Gist options
  • Save milesrout/0094dd076ada26b88d7e to your computer and use it in GitHub Desktop.
Save milesrout/0094dd076ada26b88d7e to your computer and use it in GitHub Desktop.
#include <wchar.h>
int main()
{
mbstate_t mbstate;
wchar_t const wcs[] = "\U00000055\U0000006E\U00000069\U00000063\U0000006F\U00000064\U00000065";
wchar_t const* wcsptr = wcs;
char mbs[256];
memset(&mbstate, 0, sizeof mbstate);
wcsrtombs(mbs, &wcsptr, sizeof(wcs) / sizeof(wcs[0]), &mbstate);
printf("%s\n", mbs);
wprintf("%s\n", wcs);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment