I have another suggest for those who have a homogeneous array of numbers that's elements count is unknown in advance but the size altogether will not exceed 2GB.
No redim needed if elements shall be added, all done by the powers of thinBasic.
Use a string.
How?
Uses "console"
' this will store the numbers:
Dim myNumericArray as String
' access the numbers virtually:
Dim myNumber() as Number At 0
Dim i As Long ' just to list our arrays elements
' add a few elements, type Ext equals Number, that's why MKE$:
myNumericArray = MKE$(0.12345) ' the first element be 0.12345
' just append a bunch of new elements:
myNumericArray &= MKE$(1,2,3,4,5)
' and some more
myNumericArray &= MKE$(6.666, 7.777)
' now let's read what we have:
' put the virtual array onto the string:
Redim myNumber(Strptrlen(Strptr(myNumericArray))/SizeOf(Number)) At Strptr(myNumericArray)
' list what we have
For i = 1 to UBound(myNumber)
PrintL i, myNumber(i)
Next
WaitKey
Just an idea. Typed this on the mobile, not error-checked. Perhaps the $-sign is wrong on the phone? If so someone may correct it.
But you could tell me if string reallocates faster than Redim
Bookmarks