code:
#include<stdio.h>
#include<conio.h>
void main()
{ FILE *fp1,*fp2;
char ch1,ch2,ch3;
fp1=fopen("file1","w+");
fp2=fopen("file2","w+");
printf("\n Enter file 1\nEnter string:");
do { ch1=getchar();
if(ch1!='@') fputc(ch1,fp1);
else break;
}while(ch1!='@');
rewind(fp1);
[COLOR="Red"] while(!feof(fp1))
{ ch1=fgetc(fp1);ch2=fgetc(fp1);ch3=fgetc(fp1);
if(ch1=='a'&&ch2!='n') { fseek(fp1,-2*sizeof(char),1);continue; }
if (ch1=='a'&&ch2=='n') {fseek(fp1,-sizeof(char),1);continue;}
if (ch1=='t'&&ch2=='h'&&ch3=='e') continue;
fputc(ch1,fp2); fseek(fp1,-2*sizeof(char),1);
}[/COLOR]
rewind(fp2);
while(!feof(fp2)) putchar(fgetc(fp2));
fcloseall();
getch();
}
help me? code mistake ??
Edited by WingedPanther, 02 September 2008 - 07:18 AM.
add code tags


Sign In
Create Account

Back to top









