ArrayEncode/Decode broken??
J. Landman Gay
jacque at hyperactivesw.com
Fri Mar 18 20:09:57 EDT 2022
I made the same mistake a while ago, until I remembered that the encoded
array is binary. You have to write and read it to/from a binary file. If
you just use "open file" you get text only.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On March 18, 2022 6:40:40 PM Bob Sneidar via use-livecode
<use-livecode at lists.runrev.com> wrote:
> Hi all.
>
> I'm running 9.6.7 rc2. I have this code in a closeStackRequest handler:
>
> put the settings of me into tSettingsA
> put field "fldEAFilePath" into tSettingsA ["eafilepath"]
> put field "fldInvFilePath" into tSettingsA ["invfilepath"]
> put field "fldOutFilePath" into tSettingsA ["Outfilepath"]
> put the dgText [true] of group "dgVariance" into tSettingsA ["gridtext"]
> put arrayEncode(tSettingsA) into tSettingsText
> put the filename of this stack into tSettingsPath
> set the itemDelimiter to "/"
> put "settings.prefs" into item -1 of tSettingsPath
> open file tSettingsPath for write
> write tSettingsText to file tSettingsPath
> close file tSettingsPath
>
> Then in the openStack handler I have this:
>
> put the filename of this stack into tSettingsPath
> set the itemDelimiter to "/"
> put "settings.prefs" into item -1 of tSettingsPath
> open file tSettingsPath for read
> read from file tSettingsPath until eof
> put it after tSettingsText
> close file tSettingsPath
> put arrayDecode(tSettingsText) into tSettingsA
> set the settings of me to tSettingsA
>
> Instead of an array, I get the text "gr" which is the first 2 characters of
> the key "grid text" in the array. That can't be right!
>
> Bob S
>
>
> _______________________________________________
> 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
More information about the use-livecode
mailing list