[BUG] write to file
Mike Kerner
MikeKerner at roadrunner.com
Mon Jan 25 09:02:47 EST 2016
It probably hasn't broken mine because I don't rely on the file pointers.
I always read the entire file, modify, then write the entire container back.
On Sun, Jan 24, 2016 at 10:46 PM, Kay C Lan <lan.kc.macmail at gmail.com>
wrote:
> 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?
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
--
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
and did a little diving.
And God said, "This is good."
More information about the use-livecode
mailing list