Re: Long text file manipulation...
Re: Long text file manipulation...
- Subject: Re: Long text file manipulation...
- From: Chris Nebel <email@hidden>
- Date: Fri, 06 Apr 2001 15:09:20 -0700
- Organization: Apple Computer, Inc.
Timothy Bates wrote:
>
> 'write "stuff" to file "blah" starting at eof'),
>
>
You need eof plus 1 here, or else you overwrite the last character!!!
>
>
i.e.,
>
set fpath to choose file name
>
set f to open for access (fpath) with write permission
>
write "FIRST" to f starting at (get eof f) + 1
>
write "second" to f starting at (get eof f)
>
write "THIRD" to f starting at (get eof f) + 1
>
close access f
>
set bingle to read fpath
>
bingle
Because write uses 1-based file positions, "starting at eof" is not the same
thing as "starting at (get eof f)". Also, there was a bug in 1.5.5 that
"starting at eof" would actually start one character before the end of file.
Version 1.6 and versions earlier than 1.5 don't have the problem.
--Chris Nebel
AppleScript Engineering