• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Cross version compatible way to set the file pointer to eof
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Cross version compatible way to set the file pointer to eof
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: Scripts no longer work in 9.2.2
  • Next by Date: script
  • Previous by thread: Re: Program linking issues...
  • Next by thread: Re: Cross version compatible way to set the file pointer to eof
  • Index(es):
    • Date
    • Thread