Mail Archives: djgpp/2002/12/05/19:00:25
On Thu, 5 Dec 2002 22:33:00 -0000, "Eric" <eric AT replytogroup DOT net>
wrote:
>
>Hello. I've been staring at my program for an hour and can't find the bug.
>Hope you can help :-)
>
>My code is supposed to break up a large file into several small files for
>transfer on floppy disks, then re-assemble the large file from the parts
>given the -r command. Trouble is, the re-assembled file, although the right
>size, is messed up in some way: whenever I split a large .exe, for example,
>re-assemble it and then run it, all sorts of weirdness occurs.
>
>PS: I'm a newbie and this is my most ambitious program ever, so please go
>easy :-)
>
[snip code]
I see this message also in clc. There are 1 useful advice from Jim
<sorry AT not DOT com> about your split function.
[snipet reproduced from clc]
>> unit = FLOPPY_CAPACITY;
>>
> {
char *tbuffer = buffer;
>> while (size) {
>> *fname = *name++;
>> f = fopen(fname, "wb");
>> if (f == NULL) {
>> error(FILE_IO);
>> }
>> puts("Writing...");
>> - bytes = fwrite(buffer, 1, unit, f);
+ bytes = fwrite(tbuffer, 1, unit, f)
+ tbuffer += FLOPPY_CAPACITY;
You are allways writing to yours *n* diskettes the same first
FLOPPY_CAPACITY bytes of file to split. Change the code acording Jim's
advice.
J. L.
- Raw text -