wcstok.c 414 B

1234567891011121314
  1. #include <stdio.h>
  2. #include <wchar.h>
  3. int main() {
  4. wchar_t wcs[] = L"Hello from the otter\tslide.\nMust have gone down a\t\t\t \n thousand tiiiiiimeeeees...\n\n\n";
  5. wchar_t *token;
  6. wchar_t *state;
  7. for (token = wcstok(wcs, L" \t\n", &state);
  8. token != NULL;
  9. token = wcstok(NULL, L" \t\n", &state)) {
  10. fputws(token, stdout);
  11. fputwc(L'\n', stdout);
  12. }
  13. }