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

NAME

6       ustrtok  -  Retrieves  tokens  from  a string. Allegro game programming
7       library.
8

SYNOPSIS

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

DESCRIPTION

16       This function retrieves tokens from `s' which are delimited by  charac‐
17       ters from `set'. To initiate the search, pass the string to be searched
18       as `s'.  For the remaining tokens, pass NULL  instead.  Warning:  Since
19       ustrtok  alters  the  string  it is parsing, you should always copy the
20       string to a temporary buffer before parsing it. Also, this function  is
21       not  re-entrant  (ie.  you  cannot parse two strings at the same time).
22       Example:
23
24          char *word;
25          char string[]="some-words with dashes";
26          char *temp = ustrdup(string);
27          word = ustrtok(temp, " -");
28          while (word) {
29             allegro_message("Found `%s'\n", word);
30             word = ustrtok(NULL, " -");
31          }
32          free(temp);
33

RETURN VALUE

35       Returns a pointer to the token, or NULL if no more are found.
36
37

SEE ALSO

39       uconvert(3), ustrchr(3), ustrrchr(3),  ustrstr(3),  ustrpbrk(3),  ustr‐
40       tok_r(3), allegro_message(3), ustrncpy(3), exgui(3)
41
42
43
44Allegro                          version 4.4.3                      ustrtok(3)
Impressum