Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Estimating Array Size and Making a Binary Copy

Keywords: 	 arrainfo() arrsize

Question:

How do I delete a member of an array? And how do I compact the size of the array?

I'm working with an array and when it's boundaries are reached I need to make it bigger.

Is there a way to figure out the size and address of the array so I could copy it binary, cause it takes some time to copy each element into the new array especially with very big arrays.

So what I want to do is something like this (Pseudo-Code):

;********** Example Code ************
;Get address+size for binary copy
Addr=Address(OldArray)
Size=ArrSize(OldArray)

;Create new array with more elements (let's assume old array has 800 Elements
ArrDimension(NewArray,1000)

;Get Target Address
NewAddr=Address(NewArray)
BinaryCopy(NewAddr,0,Addr,0,Size)

************ End Example ***********
Anyone have an idea on how to achieve tihs cause I can't find functions like Address or ArrSize...

Answer:

To clear a member you could do something like:
myArray[num] =""
OR
myArray[num] = 0
You cannot alter the size of an array It is a fixed size. All you could possibly do is create a new one and copy the data.

ArrInfo() will answer most of your questions about size of current array.

Perhaps the best thing to do is set your original array size to some impossible limit (given what you are doing) then use ArrInfo() to determine what you have filled, which would probably use less memory than having two arrays at once.


Article ID:   W14818