> Thank Benoit!
> 
> One more question about the below basic data structure:
> 
> aStruct * anExternFunc(...)
> 
> with:
> 
> aStruct {
> 
> aClass *data
> aStruct *previous
> aStruct *next
> }
> 
> 
> How to get all *data
> I tried
> 
> pNext = anExternFunc(...)
> while pNext <> null
> 
> pData = Pointer@(pNext)
> 
> ...
> 
> pNext = pData + SizeOf(gb.pointer)*2
> 
> wend
> 
> and failed.
> 

--8<----------------------------------------------------------

pStruct = anExternFunc(...)

While pStruct

  pData = Pointer@(pStruct)

  ...

  pStruct = Pointer@(pStruct + Sizeof(gb.Pointer) * 2)

Wend

--8<----------------------------------------------------------

That should work. Does it?

You can use a memory stream and a structure too:

--8<----------------------------------------------------------

Struct MyDataSlot
  Data As Pointer
  Previous As Pointer
  Next As Pointer
End Struct

...

Dim hMem As Stream
Dim hSlot As MyDataSlot

pStruct = anExternFunc(...)

While pStruct
 
  hMem = Memory pStruct For Read

  hSlot = Read #hMem As MyDataSlot

  pData = hSlot.Data

  ...

  pStruct = Pointer@(hSlot.Next)

Wend

--8<----------------------------------------------------------

Regards,

-- 
Benoît Minisini

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to