C File =>
/* Write a C program to copy contents of one file to another file. */
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
int main() {
FILE *fp1,*fp2;
char ch;
fp1=fopen("a.txt","r");
fp2=fopen("b.txt","w");
if(!fp1)
printf("\n Error in reading..");
if(!fp2)
printf("\n Error in writing..");
else
{
while((ch=fgetc(fp1))!=EOF)
fputc(ch,fp2);
}
return 0;
}
Comments
Post a Comment
Please do not enter any spam link in message.