I've been asking questions about serial input and arrays and am now seeking clarification of the process of adding subsequently-arrived bytes to those already received.
It is handy to have the array size set exactly right for the bytes in the serial buffer. But when I get more and wish to add them I find that the ArrayCopy() function needs a target array size large enough for both sets of bytes.
Does this mean that, because if I re-Dim the original array I lose its contents, I have to create a new array of the total size needed, do two ArrayCopy operations to load the two sequences of bytes, and then assign the new array back into the old buffer so that the rest of the code can continue as if all bytes had arrived together?
It seems a bit like hard work for both me and for the device, though admittedly only a few tens of bytes are involved at any one time.
Regards, Mike.
It is handy to have the array size set exactly right for the bytes in the serial buffer. But when I get more and wish to add them I find that the ArrayCopy() function needs a target array size large enough for both sets of bytes.
Does this mean that, because if I re-Dim the original array I lose its contents, I have to create a new array of the total size needed, do two ArrayCopy operations to load the two sequences of bytes, and then assign the new array back into the old buffer so that the rest of the code can continue as if all bytes had arrived together?
It seems a bit like hard work for both me and for the device, though admittedly only a few tens of bytes are involved at any one time.
Regards, Mike.