[ create a new paste ] login | about

Link: http://codepad.org/Da9ixGLP    [ raw code | output | fork ]

C, pasted on Oct 25:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* strtok example */
#include <stdio.h>
#include <string.h>

int main ()
{
  char str[] ="Command:Context";
  char * pch;
  printf ("Splitting string \"%s\" into tokens:\n",str);
  pch = strtok (str,":");
  while (pch != NULL)
  {
    printf ("%s\n",pch);
    pch = strtok (NULL, ":");
  }
  return 0;
}


Output:
1
2
3
Splitting string "Command:Context" into tokens:
Command
Context


Create a new paste based on this one


Comments: