12345678910111213141516171819202122232425 |
- #include <stdio.h>
- #include <string.h>
- #include <wchar.h>
- #include "test_helpers.h"
- void print_as_wide(const char* mbstr)
- {
- mbstate_t state;
- memset(&state, 0, sizeof state);
- size_t len = 1 + mbsrtowcs(NULL, &mbstr, 0, &state);
- wchar_t wstr[len];
- mbsrtowcs(&wstr[0], &mbstr, len, &state);
-
- printf("The length, including '\\0': %li \n",len);
-
-
- }
- int main(void) {
- const char* mbstr = u8"z\u00df\u6c34\U0001f34c";
- print_as_wide(mbstr);
- }
|