fork(1) download
  1. /* strtok example */
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. int main ()
  6. {
  7. char str[] ="-LAAN AIRSPDES EBTRAN3\t\n-BEGIN LABANDS";
  8. char * pch;
  9. printf ("Splitting string \"%s\" into tokens:\n",str);
  10. pch = strtok (str," \n\t\0");
  11. while (pch != NULL)
  12. {
  13. printf ("WE HAVE====>>%s\n",pch);
  14. pch = strtok (NULL, " \n\t\0");
  15. }
  16. return 0;
  17. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Splitting string "-LAAN AIRSPDES EBTRAN3	
-BEGIN LABANDS" into tokens:
WE HAVE====>>-LAAN
WE HAVE====>>AIRSPDES
WE HAVE====>>EBTRAN3
WE HAVE====>>-BEGIN
WE HAVE====>>LABANDS