Just starting out? Need help? Post your questions and find answers here.
-
ZX80
- Enthusiast

- Posts: 375
- Joined: Mon Dec 12, 2016 1:37 pm
Post
by ZX80 »
Hi, all.
This way I can read data from the array by the base pointer to it:
Code: Select all
Procedure ReadArray(*strings, size)
*ptr = *strings
For i=1 To size
Debug PeekS(PeekL(*ptr))
*ptr+SizeOf(integer)
Next
EndProcedure
Dim Strings.s(5)
Strings(0) = "AAA"
Strings(1) = "AAB"
Strings(2) = "AAC"
Strings(3) = "ABA"
Strings(4) = "ABB"
ReadArray(@strings(), 5)
So...
What if I have a structured array ? For example, I need to get both a string and an id at once.
Thank you in advance.
Last edited by
ZX80 on Sun May 05, 2024 10:02 am, edited 1 time in total.
-
infratec
- Always Here

- Posts: 7662
- Joined: Sun Sep 07, 2008 12:45 pm
- Location: Germany
Post
by infratec »
Code: Select all
Structure Test_Structure
String$
Value.i
EndStructure
Procedure ReadArray(*strings.Test_Structure, size)
Protected *ptr.Test_Structure
*ptr = *strings
For i=1 To size
Debug *ptr\String$
Debug *ptr\Value
*ptr+SizeOf(Test_Structure)
Next
EndProcedure
Dim Strings.Test_Structure(5)
Strings(0)\String$ = "AAA"
Strings(0)\Value = 0
Strings(1)\String$ = "AAB"
Strings(1)\Value = 1
Strings(2)\String$ = "AAC"
Strings(2)\Value = 2
Strings(3)\String$ = "ABA"
Strings(3)\Value = 3
Strings(4)\String$ = "ABB"
Strings(4)\Value = 4
ReadArray(@strings(0), 5)
Btw. since it is possible to use an Array as procedure parameter, this is not needed.
-
ZX80
- Enthusiast

- Posts: 375
- Joined: Mon Dec 12, 2016 1:37 pm
Post
by ZX80 »
infratec,
thanks a lot. It works !
