#include<stdio.h>
int main()
{
FILE *p1, *p2;
char f1[20], f2[20];
char ch;
printf("Enter File name which has to be copied: ");
gets(f1);
p1=fopen(f1,"r");
if(p1==NULL)
{
printf("\nUnable to open %s",f1);
return 1;
}
printf("Enter Destination file");
gets(f2);
p2=fopen(f2,"w");
if(p2==NULL)
{
printf("Cannot open %s",f2);
return 1;
}
while((ch=fgetc(p1))!=EOF)
{
if(' ' || 'a' || 'b')
ch='-';
fputc(ch,p2);
}
printf("Completed");
fclose(p1);
fclose(p2);
return 0;
}
int main()
{
FILE *p1, *p2;
char f1[20], f2[20];
char ch;
printf("Enter File name which has to be copied: ");
gets(f1);
p1=fopen(f1,"r");
if(p1==NULL)
{
printf("\nUnable to open %s",f1);
return 1;
}
printf("Enter Destination file");
gets(f2);
p2=fopen(f2,"w");
if(p2==NULL)
{
printf("Cannot open %s",f2);
return 1;
}
while((ch=fgetc(p1))!=EOF)
{
if(' ' || 'a' || 'b')
ch='-';
fputc(ch,p2);
}
printf("Completed");
fclose(p1);
fclose(p2);
return 0;
}
No comments:
Post a Comment