Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main ()
  5. {
  6.   char str[] ="bla,bla,bla,bla";
  7.   char *pch;
  8.   int sampleInt;
  9.  
  10.   FILE *pFile;
  11.   char line[1337];
  12.  
  13.   pFile = fopen ("myfile.txt" , "r");
  14.   while (fgets(line, 1337, pFile) != NULL ) {
  15.   pch = strtok(str, ",");
  16.   while (pch != NULL) {
  17.     // mach was mitm string
  18.     sscanf("%d", &sampleInt);
  19.     // saug dir den naechsten token
  20.     pch = strtok(NULL, ",");
  21.   }
  22.   }
  23.   return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement