Advertisement
BORUTO-121

workinWithtxt

Sep 18th, 2021
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main(){
  4.   char x,y;
  5.   printf("Unesite znakove x i y: ");
  6.   scanf(" %c %c",&x,&y);
  7.   if(x>y){
  8.     printf("Pogresan unos");
  9.     return 1;
  10.   }
  11.   FILE* ulaz=fopen("input.txt","r");
  12.   if(ulaz==NULL){
  13.     printf("Datoteka ne postoji");
  14.     return 1;
  15.   }
  16.   FILE* izlaz=fopen("output.txt","w");
  17.  
  18.   int c;
  19.  
  20.   while((c=fgetc(ulaz))!=EOF){
  21.     for(;c!=EOF && c>=x && c<=y;c=fgetc(ulaz))
  22.       fputc(c,izlaz);
  23.   }
  24.   fclose(ulaz);
  25.   fclose(izlaz);
  26.   return 0;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement