Data inside a structure

Just starting out? Need help? Post your questions and find answers here.
User avatar
em_uk
Enthusiast
Enthusiast
Posts: 366
Joined: Sun Aug 08, 2010 3:32 pm
Location: Manchester UK

Data inside a structure

Post by em_uk »

Hi guys and gals.

I am trying to store multiple blobs of 16 bytes - so I thought the easiest way would be to create a list.


Structure LayersStructure
List Data.i()
EndStructure

Global Dim Scenes.LayersStructure(100)

I now have an array with each element containing a Data() integer with a size of 0 - the question is - how do I put and pull data out of that Data() section?

Thanks!
----

R Tape loading error, 0:1
User avatar
em_uk
Enthusiast
Enthusiast
Posts: 366
Joined: Sun Aug 08, 2010 3:32 pm
Location: Manchester UK

Re: Data inside a structure

Post by em_uk »

Not to worry,

I've changed it to

Code: Select all

Structure LayersStructure
  Array Data.i(64)
EndStructure
Now I can access with Scenes(0)\Data(0)
----

R Tape loading error, 0:1
infratec
Always Here
Always Here
Posts: 7620
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Data inside a structure

Post by infratec »

Only as hint:

Code: Select all

Structure LayersStructure
  Map Data.i()
EndStructure

Global Dim Scenes.LayersStructure(100)

Scenes(0)\Data("0") = 10

If FindMapElement(Scenes(0)\Data(), "0")
  Debug Scenes(0)\Data()
EndIf
User avatar
mk-soft
Always Here
Always Here
Posts: 6252
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Data inside a structure

Post by mk-soft »

em_uk wrote: I am trying to store multiple blobs of 16 bytes - so I thought the easiest way would be to create a list.

Code: Select all

;-TOP

Structure LayersStructure
  StructureUnion
    bArray.b[16] ; 0..15
    aArray.a[16] ; 0..15
  EndStructureUnion
EndStructure

Global Dim MyData.LayersStructure(100) ; 0 .. 100

MyData(0)\aArray[0] = 255

Debug MyData(0)\aArray[0] ; Unsigned
Debug MyData(0)\bArray[0] ; Signed
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply