Write a c program to copy one file to another while doing so replace lowercase to uppercase character

#include<stdio.h>
#include<conio.h>
void main()
{
FILE *fp1,*fp2;
char *fn1,*fn2,ch;
clrscr();
printf("\n enter the source file");
gets(fn1);
printf("\n enter the destination file");
gets(fn2);
fp1=fopen(fn1,"r");
fp2=fopen(fn2,"w");
if(fp1==NULL||fp2==NULL)
{
printf("\n unable to open file");
exit(0);
}
while(!feof(fp1))
{
ch=fgetc(fp1);
if(ch>='a'&& ch<='z')
ch=ch-32;
fputc(ch,fp2);
}
printf("\n file successfully copied");
fcloseall();
getch();
}

Comments

Post a Comment