Josif_tepe

Untitled

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