Read/Write 'as short' and 'write "" starting at'
Read/Write 'as short' and 'write "" starting at'
- Subject: Read/Write 'as short' and 'write "" starting at'
- From: Arthur J Knapp <email@hidden>
- Date: Tue, 31 Jul 2001 11:37:32 -0400
A great many changes have occured in the read/wrtie commands of Standard
Additions since the last time I tried to extensively use them. I wanted to
post some examples:
-- This use to work:
read open_file for 2 as short
--
--> error "Can't make short into a type class."
The "as short" parameter could be used to obtain 2-byte integers
from a binary file, but now it seems to be broken. I remembered,
however, that the raw code was "shor", so I typed this:
read open_file for 2 as +class shor;
It compiled as:
read open_file for 2 as small integer
--
--> 1138
and seems to work OK.
-- This use to work:
write "" to open_file starting at 30
--
-- ie: move file mark to 30
--
--> error "Parameter error."
This is annoying. The old AppleScript Script Additions Guide
itself gave this type of syntax as an example of how to move the
file marker without having to read content into the script.
In fact, it used to work whether or not the file had been open
with write permission. Now, the only way to jump around in the
file is by reading, which can cause memory and speed problems.
Most frustrating of all, of course, is the fact that none of this
is documented anywhere. Bill Cheeseman's report on the newest OSs
does mention changes with regard to "using delimiters" and the
reading/writing of lists and records, but someone, somewhere, really
needs to sit down with the read/wrtie commands and document their
current functionality, especially with regard to the "as" parameter.
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://www.latenightsw.com/freeware/JavaScriptOSA/