reading a character from one file writing it twice in another file
#include <stdio.h>
int main(){
FILE *ptr1,*ptr2;
ptr1=fopen("file1.txt","r");
ptr2=fopen("file2.txt","w");
char c;
c=fgetc(ptr1);
while(c!=EOF)
{
fputc(c,ptr2);
fputc(c,ptr2);
c=fgetc(ptr1);
}
fclose(ptr1);
fclose(ptr2);
return 0;
}
Comments
Post a Comment