[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: When Writing then reading a multi dim array it is changed to single dim array
[Thread Prev] | [Thread Next]
- Subject: Re: When Writing then reading a multi dim array it is changed to single dim array
- From: Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx>
- Date: Thu, 4 Jul 2024 03:26:53 +0300
- To: user@xxxxxxxxxxxxxxxxxxxxxx
Yeah, it seems dimensions are not written. You need to write them separately. https://gambaswiki.org/wiki/lang/datarep?nh Jussi On Thu, Jul 4, 2024 at 3:21 AM Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> wrote: > Can you write and read it as an array with the dimension specified? > I guess Interger[] does not serialize its dimensions. > > Jussi > > On Thu, Jul 4, 2024 at 3:03 AM Brian G <brian@xxxxxxxxxxxxxxxx> wrote: > >> if I have a multi dimensional array and write it as an object, then read >> it back it becomes a single dimensional array. >> >> The number of entries remain the same, just the dimensions are lost. >> >> I don't know if this a bug or a feature? >> >> sample script >> >> ----------------------------------------------------- >> >> #!/usr/bin/env gbs3 >> >> Dim a As New Integer[5, 5, 5] >> Dim b As Integer[] >> >> Dim x As Pointer = Alloc(5000) >> Dim mfile As File >> >> mfile = Memory x For Write >> Write #mfile, a As Object >> Close mfile >> >> mfile = Memory x For Read >> b = Read #mfile As Object >> >> Print Subst("Before saving array count=&1, Dim=&2", a.count, a.dim) >> Print Subst("After reading array count=&1, Dim=&2", b.count, b.dim) ' >> they don't match >> >> Quit 0 >> Catch >> Error "Script Error >";; error.text & "\n" & error.where >> >> >> ------------------------------------------------------------------------------------------ >> >> -- >> ~~~~ Brian >> >>
Re: When Writing then reading a multi dim array it is changed to single dim array | brian <brian@xxxxxxxxxxxxxxxx> |
When Writing then reading a multi dim array it is changed to single dim array | Brian G <brian@xxxxxxxxxxxxxxxx> |
Re: When Writing then reading a multi dim array it is changed to single dim array | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |