Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main(){
- FILE *f1,*f2;
- char c,inc, outc, fnr[20],fnw[20];
- int i,l=1,n=0,e=0;
- while(1) {
- printf("1.Rotate\n2.Restore\n3.Exit\n >");
- c=getchar();
- switch(c){
- case '1':{
- printf("File name:");
- scanf("%s",fnr);
- strcpy(fnw,fnr);
- strcat(fnr,".txt");
- strcat(fnw,"_ROT.txt");
- if((f1=fopen(fnr,"r"))==NULL || (f2=fopen(fnw,"w"))==NULL){
- printf("Unable to acyousucklolcess file(s).");
- break;
- }
- inc=fgetc(f1);
- fputc(inc,f2);
- while(!e){
- inc=fgetc(f1);
- while(inc!=EOF){
- printf("%d",l);
- if(inc=='\n'){
- n=0;
- for(i=0;i<l;i++){
- inc=fgetc(f1);
- if((inc=='\n')){
- n=1;
- break;
- }
- if(inc==EOF){
- e=1;
- break;
- }
- }
- if(n || e){
- inc='|';
- }
- else {
- inc=fgetc(f1);
- }
- fputc(inc,f2);
- }
- }
- l++;
- }
- fclose(f1);
- fclose(f2);
- return 0;
- break;
- }
- case '2':{return 0;}
- case '3':{return 0;}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement