[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
C question on //GS
- Subject: C question on //GS
- From: Dan <dan.reisig@dreisig.com>
- Date: Thu, 30 Sep 2004 21:00:37 GMT
- Newsgroups: comp.sys.apple2
- Organization: Comcast Online
- User-agent: Microsoft-Outlook-Express-Macintosh-Edition/5.02.2022
- Xref: g2news1.google.com comp.sys.apple2:4678
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?