B4R Question question about array of byte , type and array of type

candide

Active Member
Licensed User
can i make something like that :

B4X:
Sub Process_Globals
    Type pay_st(valu(120) As Byte)
    Private store(30) As pay_st
end sub

and after can i store each array of byte by store(0).valu = temp
and can i read each array of byte by temp = store(1).valu

objective is to store 30 arrays of byte with length max 120 bytes, but i don't known if memory is reserved at compilation. from first tests done, no error found at compilation, but after i don't find data stored...

thanks for your help
 

thetahsk

Active Member
Licensed User

Try this:
B4X:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 300
#End Region

Sub Process_Globals
    Public Serial1 As Serial
    Type pay_st(value(120) As Byte)
    Private store(30) As pay_st
End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    For ii=0 To store.Length-1
        filltheStore(ii)
    Next
End Sub

Private Sub filltheStore(i As Int)
    store(i).value=NumberFormat(i,50 ,0)
    Log(store(i).value," AR=",AvailableRAM,TAB,"SBU:",StackBufferUsage)
End Sub
 
Upvote 0
Top