[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C question on //GS
Dan <dan.reisig@dreisig.com> wrote in message news:<BD81EC53.907%dan.reisig@dreisig.com>...
> My first stab at a 'C' program was a file dump utility that displays
> the contents of any file (including subdirectories) in a hex dump format
> similar to the monitor memory dump.
> My question concerns file handling using ORCA/C (although it may be a
> question concerning GS/OS).
> My initial attempt opened the file in binary mode, read a block of data
> from the file (in this case, 384 byte blocks, 24 lines by 16 bytes),
> and looping through a routine to format the display lines, read the next
> block, etc. until the end of the file is reached (or the user quits).
> What I found was that after reading from a file longer than about 1200
> bytes, the program would repeat part of the first section of the file
> in the display. This didn't happen on files smaller than that, and I
> seem to have eliminated the problem by doing a seek to the beginning
> of the file before the first read.
> What is going on hear? Any ideas?
You have a bug in line 47 of your code.
Of course my clairvoyance isn't as good as it used to be, so I could
be wrong.
Post the minimum amount of code that exhibits this behavior, but in
comp.sys.apple2.programmer, and let's have a look see.