strtok, descripcion y ejemplo

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 /* strtok example */
00003 #include <stdio.h>
00004 #include <string.h>
00005 
00006 int main ()
00007 {
00008   char str[] ="- This, a sample string.";
00009   char * pch;
00010   printf ("Splitting string \"%s\" into tokens:\n",str);
00011   pch = strtok (str," ,.-");
00012   printf ("str:%s\n",pch);
00013   while (pch != NULL)
00014   {
00015     printf ("%s\n",pch);
00016     pch = strtok (NULL, " ,.-");
00017   }
00018   return 0;
00019 }