/* write a c program to copy the one file into another while doing so replace all lower case
into upper case character */
#include<stdio.h>
#include<conio.h>
void main()
{
FILE *ft,*fs;
char ch;
clrscr();
fs=fopen("d:\peer.txt","r");
if(fs==NULL)
{
printf("source file cannot open");
exit(0);
}
ft=fopen("d:\peer2.txt","w");
if(ft==NULL)
{
printf("source file cannot open");
exit(0);
}
while(1)
{
ch=fgetc(fs);
if(ch==EOF)
break;
else
if(islower(ch))
fputc(toupper(ch),ft);
else
fputc(ch,ft);
}
getch();
}
No comments:
Post a Comment