All the books that I have read, say that strtok will break a string into tokens. This is true, but a more obvious explanation is, that it will break a string into words.
strtok requires a string and the word delimiters, for example:word = strtok(string, " "); A A | | | ------- Delimiters. | -------------- String to break up.Library: string.h Prototype: char * strtok(char *s, const char *delim); Syntax: char string []="abc def ghi"; char * word; word=strtok(string, " "); word=strtok(NULL, " ");
After the first call to strtok, word will point to abc on the second call, word will point to def
word = strtok(string, " \t;:,");
Top | Master Index | Keywords | Functions |