2dye4
Military
- Mar 3, 2004
- 494
The following is my program
FILE *floppy;
FILE *destination;
floppy=fopen("a:\picture.jpg","rb");
destination=fopen("c:\pictures\save.jpg","rb");
do
{
hold=fgetc(floppy);
fputc(hold,destination);
}while(!feof(floppy);
The goal is copy a picture file from a floppy to
the hard drive. Worked fine until in encountered
a corrupt file on the floppy and then there was
no ending to this loop. feof never returned a non-zero
value. It wrote a 1.3 Gig file to my hard drive before
I canceled the program.
I know I can count bytes and stop at an absurd number
but there should be a more elegant way
This was compiled to a win32 console app with borland 5.5
and was running on Winxp home
any ideas
Thanks
FILE *floppy;
FILE *destination;
floppy=fopen("a:\picture.jpg","rb");
destination=fopen("c:\pictures\save.jpg","rb");
do
{
hold=fgetc(floppy);
fputc(hold,destination);
}while(!feof(floppy);
The goal is copy a picture file from a floppy to
the hard drive. Worked fine until in encountered
a corrupt file on the floppy and then there was
no ending to this loop. feof never returned a non-zero
value. It wrote a 1.3 Gig file to my hard drive before
I canceled the program.
I know I can count bytes and stop at an absurd number
but there should be a more elegant way
This was compiled to a win32 console app with borland 5.5
and was running on Winxp home
any ideas
Thanks