1.TH strtok 3 scc\-VERSION2.SH NAME3strtok - break a string into tokens4.SH SYNOPSIS5#include <string.h>67char *strtok(char *restrict s1, const char *restrict s2)8.SH DESCRIPTION9The10.BR strtok ()11function splits the string at12.I s113into a series of tokens, each bounded by one or more delimiter characters14drawn from the string at15.IR s2 .16It is called repeatedly to extract successive tokens.17.PP18The first call must pass the string to tokenize as19.IR s1 ;20subsequent calls must pass NULL as21.I s122to continue where the previous call left off.23.PP24The delimiter set in25.I s226may differ between calls.27.PP28On each call, the function advances past any leading delimiter characters,29then locates the next delimiter in the remainder of the string.30If no non-delimiter character is found, no tokens remain31and a null pointer is returned.32Otherwise, that character marks the start of a new token.33.PP34When the end of the token is found,35it is terminated by overwriting the delimiter character with a null byte.36A pointer to the next character is saved internally37and used as the starting point for the following call.38If no delimiter follows the token,39subsequent calls will return a null pointer.40.PP41After the first call, each subsequent call with NULL as42.I s143resumes scanning from the saved position,44applying the same logic described above.45.SH RETURN VALUE46The47.BR strtok ()48function returns a pointer to the first character of the current token,49or a null pointer when no more tokens are found.50.SH STANDARDS51ISO/IEC 9899:1999 Section 7.21.5.8