1ustrtok_r(3)                    Allegro manual                    ustrtok_r(3)
2
3
4

NAME

6       ustrtok_r  - Reentrant function to retrieve tokens from a string. Alle‐
7       gro game programming library.
8

SYNOPSIS

10       #include <allegro.h>
11
12
13       char *ustrtok_r(char *s, const char *set, char **last);
14

DESCRIPTION

16       Reentrant version of ustrtok. The `last'  parameter  is  used  to  keep
17       track  of  where the parsing is up to and must be a pointer to a char *
18       variable allocated by the user that remains the same while parsing  the
19       same string. Example:
20
21          char *word, *last;
22          char string[]="some-words with dashes";
23          char *temp = ustrdup(string);
24          word = ustrtok_r(string, " -", &last);
25          while (word) {
26             allegro_message("Found `%s'\n", word);
27             word = ustrtok_r(NULL, " -", &last);
28          }
29          free(temp);
30

RETURN VALUE

32       Returns  a  pointer to the token, or NULL if no more are found. You can
33       free the memory pointed to by `last' once NULL is returned.
34
35

SEE ALSO

37       ustrtok(3)
38
39
40
41Allegro                          version 4.4.3                    ustrtok_r(3)
Impressum