Josif_tepe

Untitled

Aug 24th, 2026
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4. #include <math.h>
  5. int main(int argc, char * argv[]) {
  6.     FILE * in = fopen(argv[1], "r");
  7.     FILE * out = fopen(argv[2], "w");
  8.  
  9.     if(in == NULL || out == NULL) {
  10.         printf("Ne postoi datotekata\n");
  11.         return 0;
  12.     }
  13.  
  14.     char niza[2000];
  15.     int j = 0;
  16.     char c;
  17.     while((c = fgetc(in)) != EOF) {
  18.         if(c == '\n') {
  19.             for(int i = 0; i < j; i++) {
  20.                 printf("%c", niza[i]);
  21.             }
  22.  
  23.             printf("\n");
  24.  
  25.             j = 0;
  26.         }
  27.         else {
  28.             niza[j] = c;
  29.             j++;
  30.         }
  31.     }
  32.  
  33.  
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment