9 static char str[] = "?a???b,,,#c";
10 const char str2[] = "axaaba";
11 char *token = strtok(str, "?"); // 'token' points to the token "a"
12 ASSERT( token == &str[1] && 0 == strcmp(token,"a"));
13 token = strtok(NULL, ","); // 'token' points to the token "??b"
14 ASSERT( token == &str[3]&& 0 == strcmp(token,"??b"));
15 token = strtok(NULL, "#,"); // 'token' points to the token "c"
16 ASSERT( token == &str[10] && 0 == strcmp(token,"c"));
17 token = strtok(NULL, "?"); // 'token' is a null pointer
18 ASSERT( token == NULL);
20 token = strtok (str2, "ab");
21 ASSERT( token && 0 == strcmp (token, "x"));
22 token = strtok(NULL, "ab");
23 ASSERT( token == NULL);
24 token = strtok(NULL, "a");
25 ASSERT( token == NULL);