| www.delorie.com/djgpp/doc/libc-2.01/libc_624.html | search |
#include <string.h> char *strtok(char *s1, const char *s2);
This function retrieves tokens from s1 which are delimited by characters from s2.
To initiate the search, pass the string to be searched as s1. For
the remaining tokens, pass NULL instead.
A pointer to the token, or NULL if no more are found.
main()
{
char *buf = "Hello there, stranger";
char *tok;
for (tok = strtok(buf, " ,");
tok;
tok=strtok(0, " ,"))
printf("tok = `%s'\n", tok);
}
tok = `Hello'
tok = `there'
tok = `stranger'
Go to the first, previous, next, last section, table of contents.
| prev next webmaster | delorie software privacy |
| Copyright © 1997 | Updated Apr 1997 |