Arrays of any size

Gale Johnson

Member
Licensed User
Perhaps this is elementary, but I needed very large arrays of information for my program. I put all the information in a single-dimension array and then strip the parts out when needed.
Example: ser="12b*3a4*5n6*78y*9ab2nm*"

dim a(5)
h1=0
For x=1 to 5:g1=Strindexof(ser,"*",h1)
a(x)=Substring(ser,h1,g1-h1)
h1=g1+1:next x
 

Rioven

Active Member
Licensed User
yes, a(x-1) works for Dim a(5)

for me as an alternative approach, If it is large or varying handling data memory assignments, maybe I'll try the method that the code will create file as data memory which it could arrange and simplify informations, then access and manipulate by read and write in this file. Not sure if applicable to your program.
 

Rioven

Active Member
Licensed User
Thanks Erel, bit :sign0006:but if I wan't to store large random data, Is it efficient using binary files? or what is the right method?
 

Erel

Administrator
Staff member
Licensed User
It depends on the type of the data.
If you save only numbers then random files are the best solution.
That is because you can easily calculate the position of each value (NumberOfBytes * Index).
However strings do not have a fixed size so it is much more complicated to find the position of each value, making it less useful in that case.
 
Top