SHARE
TWEET

Untitled

razvanth21 Nov 28th, 2018 (edited) 7 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top