Cross version compatible way to set the file pointer to eof
Cross version compatible way to set the file pointer to eof
- Subject: Cross version compatible way to set the file pointer to eof
- From: Timothy Bates <email@hidden>
- Date: Fri, 07 Dec 2001 10:53:42 +1100
Hi there,
I have a library of handlers I distribute with PsyScript. On eof these
handles writing quasi-arbitrary data to a spreadsheet file.
What I did was open the file, then set the pointer to the eof so that
subsequent writes would append data.
Under AS 1.4 I just said
write "" to f starting at eof
This broke under AS 1.6 (I think) so I moved to
read 0 from f starting at eof
But my users now tell me that this is incompatible with the version of AS
that comes with OS9 (=AS1.4): You can't read no bytes (error -40)
Is there a version-independent way to set the pointer to eof? I want it to
be very quick, as this might need to be called 2 times a second and should
return in a few milliseconds. So that rules out reading until I fall off the
end of the file.
My solution currently is to explicitly direct all writes to the eof, rather
than presetting the pointer to eof, i.e.,
write "string" to f starting at eof
but it would be nice to be able to just say
write string to f
As there are sometimes several dozen calls to write within 1 call to the
handler.
tim