0% found this document useful (0 votes)
6 views

ass6a2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

ass6a2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

#include<stdio.

h>
#include<string.h>
#include<stdlib.h>

void main()
{
FILE *fp1,*fp2;
char ch,c,fname1[20],fname2[20];
long int size;
printf("Enter the filename1:");
scanf("%s",fname1);
printf("Enter the filename1:");
scanf("%s",fname2);
fp1=fopen(fname1,"r");
fp2=fopen(fname2,"a");

if(fp1==NULL)
{
printf("File opening error");
exit(0);
}
while (!feof(fp1))
{
ch=fgetc(fp1);
if(islower(ch)&& ch!=EOF)
fprintf(fp2,"%c",toupper(ch));
else if(isupper(ch)&& ch!=EOF)
fprintf(fp2,"%c",tolower(ch));
else if(ch!=EOF)
fprintf(fp2,"%c",ch);
}
fclose(fp2);
fclose(fp1);
fp2=fopen(fname2,"r");
while(!feof(fp2))
{
fscanf(fp2,"%c",&ch);
printf("%c",ch);
}
fclose(fp2);
}

You might also like