Reading/Deleting Last Line Of File
J. Landman Gay
jacque at hyperactivesw.com
Fri Feb 12 20:35:43 EST 2010
Alex Tweedly wrote:
> I strongly suspect it only works on Windows :-( Sorry.
> I don't have either a Mac or Linux box to try it on, however I did just
> try it on the on-rev server (as an .irev script) and it also appears to
> leave the file unchanged there.
I wonder if it has to do with the OS-dependent line-ending conversion
that the engine does when it writes to text files. If you open the file
as binfile instead of plain "file" you'll avoid that conversion. It
might work differently that way.
>
> Playing around some more, it appears that the results of write to file
> in these odd cases are not always what you'd expect.
>
> I would have expected the following two fragments to be equivalent
>
>> seek to 2 in file "b.txt"
>> write "x" to file "b.txt"
> and
>
>> write "x" to file "b.txt" at 2
That looks right. The "write" command always begins writing at the
postion after the pointer. But when you specify an exact postion in
particular, it writes where you tell it.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list