Files
2024-08-31 12:07:21 +03:00

26 lines
522 B
C

#include<stdio.h>
int main(){
FILE *fp;
int i,c,cnt=0;
char buff[1000];
fp=fopen("file1.txt","r");
if(fp==NULL){
perror("Error in opening file\n");
return (-1);
}
do{
for(cnt=0;(c=fgetc(fp)) != "\n" && c!=EOF;cnt++){
buff[cnt]=c;
}
buff[cnt]='\0';
for(i=cnt-1;i>=0;i--){
printf("%c",buff[i]);
}
printf("\n");
if(feof(fp)){
break;
}
}while(1);
fclose(fp);
return 0;
}