Advertisement
snaptrap013

hafiz

May 25th, 2021
596
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     char records[100][256];
  6.     int i = 0;
  7.     FILE * my_file = fopen("TEST.txt", "r");
  8.     while( fscanf(my_file, "%[^\n]\n", &records[i]) != EOF )
  9.     {
  10.         printf("%s\n", records[i]);
  11.         i++;
  12.     }
  13.     fclose(my_file);
  14.     FILE * file_output = fopen("OUTPUT.txt", "w");
  15.     for(int j = 0; j < i; j++)
  16.     {
  17.         fprintf(my_file, "%s,%s,%s\n", records[j], type_fees, total);
  18.         // if ( j == i )
  19.         //     fprintf(my_file, "\n", records[i]);
  20.     }
  21.     fclose(file_output);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement