
Click above to get retro games delivered to your door ever month!
X-Hacker.org- libc - <b>strtok</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
strtok
======
Syntax
------
#include <string.h>
char *strtok(char *s1, const char *s2);
Description
-----------
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.
Return Value
------------
A pointer to the token, or `NULL' if no more are found.
Example
-------
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'
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson