Link to home
Start Free TrialLog in
Avatar of folletxavier
folletxavier

asked on

Array to array

Is there a fast(no loops) way to copy the content of an array to another array?
I actually need to copy the value of the fields 5 to 9 from a first array( dim myFirstArr(0 to 9) ) to a second array (dim mySecondArr(0 to 4)).

Thanks.
/Xavier
Avatar of andyclap
andyclap
Flag of United Kingdom of Great Britain and Northern Ireland image

It depends on what the array contains. Under certain circumstances, it's possible to use rtlmovememory to copy the array contents at a low level. You'll have problems doing this however if the array contains objects or (I think, though I'm not 100% sure) variable length strings.
Avatar of folletxavier
folletxavier

ASKER

>>It depends on what the array contains
My arrays are byte arrays.
Do you have some code demonstrating the use of rtlmovememory?
/Xavier
ASKER CERTIFIED SOLUTION
Avatar of Vbmaster
Vbmaster

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
For the above to work make sure you define the arrays with code like "Dim myFirstArr(0 to 9) As Byte" and "Dim mySecondArr(0 to 4) As Byte".
I actually had time to find out about it myself but your code is exactly what I found so full points for you.
Thanks
/Xavier
VBMaster - you got there first!

A problem with EE is that only one can get the grade and the points... This results in unfair question validation. I was forced to give points to 1 of you guys though you worked on it both.
Sorry
/Xavier
No worries. It sometimes adds to the fun - trying to type an answer out as quickly as possible before somebody else gets in :)
Cool!
Thanks again
'Till next time!
Reguards
/Xavier