[comp.sys.apple] TML Pascal help needed!

dgiles@polyslo.UUCP (Darren Giles) (04/26/88)

   Help!  I've been using TML Pascal for the IIGS for awhile now, and just
ran into my first MAJOR problem:
   How can you write a single byte to the disk?  I've tried using 
write with char type, and -128..127 like the book reccommends... but they
both write the byte followed by a second byte which is always zero.
There's got to be a way around that zero, but I can't figure out what it
is!  If you have any ideas, PLEASE let me know.

                                                      - Darren

mw22+@andrew.cmu.edu (Michael Alan Wertheim) (04/27/88)

I don't have TML Pascal, but you might try this:

Read an integer from the disk at the location you want to write, and store this
value in the variable OldValue.  Separate the integer into its components with
"Low:= OldValue MOD 256; High:= OldValue DIV 256".

Depending on whether the data is stored on the disk in high/low form or
low/high form, do either "Low:= NewValue" or "High:= NewValue".

Then, set "NewValue:= 256*High + Low", and write NewValue to the disk.  This
will write your value to the first byte and will write the old value of the
second byte to the second byte.



Michael Wertheim
Carnegie Mellon University
Pittsburgh, PA

Arpa: mw22@andrew.cmu.edu
Bitnet: mw22%andrew@cmccvb