#include(stdio.h) // place this '<' & '>' instead of '(' & ')' before stdio.h
#include(conio.h)
int main( )
{
FILE *fp, *fq ;
char file1[20], file2[20];
char ch;
clrscr( );
printf("Enter the source filename to be copied:");
gets(file1);
fp=fopen(file1, "r");
if(fp==NULL)
{
printf("\nCannot open %s",file1);
exit(0);
}
printf("\nEnter the destination filename:");
gets(file2);
fq=fopen(file2, "w");
while((ch=getc(fp))!=EOF )
{ putc(ch,fq); }
printf("\n Copied Sucessfully..");
fclose(fp);
fclose(fq);
getch( );
return 0;
}
Note:- If u have any doubt regarding this program or logic, please feel free to contact me.
Monday, January 19, 2009
Subscribe to:
Post Comments (Atom)
so good.better to write algorithms,flow charts
ReplyDeletebest of luck.better to write algorithms,flow charts,remaining syllabus programs
ReplyDeletecan u plz explain this program step-wise and show the outfigure of output....plzzzzzzz
ReplyDeletecan u plz explain about fopen and fclose in short
ReplyDelete