Advertisement
razvanth21

Untitled

Nov 28th, 2018
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void read(FILE *f)
  5. {
  6.     if (f)
  7.     {
  8.         char str[192];
  9.         char aux_str1[96], aux_str2[64];
  10.         int aux_nr1, aux_nr2;
  11.  
  12.         while (fgets(f, str, sizeof(str)))
  13.         {
  14.             if (fscanf(f, "%[^\n] REQPROD %d/%s;%d :", aux_str1, &aux_nr1, aux_str2, &aux_nr2) == 4)
  15.                 fprintf(stdout, "%d, %d\n", aux_nr1, aux_nr2);
  16.         }
  17.     }
  18. }
  19.  
  20. int main(void)
  21. {
  22.     FILE *f = fopen("test.txt", "r");
  23.  
  24.     if (!f)
  25.         exit(-1);
  26.  
  27.     read(f);
  28.     fclose(f);
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement