strtok()

Syntax
  #include <string.h>

  
  char *strtok(char *p, const char *q);

  
Description

strtok() breaks the string p into tokens which are separated by at least one character appearing in q. The first time, call strtok() using the original string as the first parameter. Afterwards, pass NULL as first parameter: strtok() will continue at the position it stopped the previous time. strtok() saves the string p if it is not NULL.

Note: This function is not re-entrant because it uses a global variable for saving string p. ANSI defines this function in this way.
Return

A pointer to the token found, or NULL, if no token was found.

See also

strchr(),

strcspn(),

strpbrk().

strrchr(),

strspn(), and

strstr()