reading a file's content character by character and printing it in another file twice
#include<stdio.h>
int main()
{
FILE *ptr;
FILE *fptr;
fptr=fopen("write.txt","w");
ptr=fopen("ab.txt","r");
char c;
c=fgetc(ptr);
while(c!=EOF)
{
fputc(c,fptr);
fputc(c,fptr);
c=fgetc(ptr);
}
fclose(ptr);
fclose(fptr);
}
Comments
Post a Comment