[BUG] write to file

Kay C Lan lan.kc.macmail at gmail.com
Sun Jan 24 22:46:54 EST 2016


The Dictionary says that if I open a file for 'update', then 'read from
file' to a specific position that when I 'write to file' it will occur at
the position I've read to but that's not what I'm seeing in 6.6.5GM, 7.1.1
rc4 and 8.0 dp13 - OS X 10.9.5. In the msg box:

set the defaultFolder to specialFolderPath("documents")
put "trash this file.txt" into tFileName
put "This is a test." into URL ("file:" & specialFolderPath("documents") &
"/" & tFileName)
open file tFileName for update
read from file tFileName for 2 words
put it into tResult
write "open/read/write/close" to file tFileName
close file tFileName
put URL  ("file:" & specialFolderPath("documents") & "/" & tFileName) into
msg
put cr & tResult after msg

I was expecting:
This is open/read/write/close

What I'm getting:
This is a test.open/read/write/close

The 'read' portion is clearly working correctly so there is something wrong
with 'write' but I'm surprised that this hasn't broken people's code left
right and centre so what am I doing wrong? How do I get LC to write from
where I've read to?



More information about the Use-livecode mailing list