: Hi
:
: Another question on String Function, strtok.
:
: For strtok, here is the explanation,
http://www.cplusplus.com/ref/cstring/strtok.html
: and my question follows in
blue[/blue]
:
: Summerize what they say... is this simply to separate
delimiter from other deliminater...? Then, is using
while the only way to see its result...?
:
: This is the trial code introduced on the site above;
:
: /* strtok example */
: #include <stdio.h>
: #include <string.h>
:
: int main ()
: {
: char str[] ="This is a sample string,just testing.";
: char * pch;
: printf ("Splitting string \"%s\" in tokens:\n",str);
: pch = strtok (str," ");
: while (pch != NULL)
: {
: printf ("%s\n",pch);
: pch = strtok (NULL, " ,.");
: }
: return 0;
: }
:
:
:
Output
: Splitting string "This is a sample string,just testing." in tokens:
: This
: is
: a
: sample
: string
: just
: testing
:
Correct.
Greets,
Eric Goldstein
www.gvh-maatwerk.nl