//BCA Support
//www.bcasupport.xyz
#include <stdio.h>
void main()
{
FILE *fp1,*fp2;
char fname1[13],fname2[13],ch;
clrscr();
printf("\nEnter file to copy : ");
gets(fname1);
fp1=fopen(fname1,"r");
if(fp1==NULL)
{
printf("\nFile not found.");
getch();
exit();
}
printf("\nEnter file to copy to : ");
gets(fname2);
fp2=fopen(fname2,"w");
if(fp2==NULL)
{
printf("\nError in creating file.");
getch();
exit();
}
while(!feof(fp1))
{
ch=fgetc(fp1);
if(ch==' ')
{
while(ch==' ')
ch=fgetc(fp1);
fputc(' ',fp2);
}
fputc(ch,fp2);
}
printf("\nContents squeezed successfully and copied to %s",fname2);
fcloseall();
getch();
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.