array_copy()

Copies data from one array to another.

Syntax

array_copy(hnd, from, pos, start, len);

Parameters

hnd Destination array handle - array to which we copy the data.
from Source array handle - array from which we copy the data.
pos Position of copied data at the destination array. Special values are:
0 - first position of array.
-1 - end position of array.
Other: 1,2,3… (zero based numbering is used (1st position has number zero, 2nd number one etc…).
start Start position of data in source array. Special values are:
0,1,2,3… (zero based numbering is used (1st position has number zero, 2nd number one etc…).
len Length of the data to be copied.
Return Value Return value is new size of destination array. Returned value is integer number.

Example

from = array_new();
array_setdata(from, 0, 0x01, 0x02, 0x03, 0x04, 0x05);
result = array_printdata(from);
hnd = array_new();
result = array_printdata(hnd);
array_copy(hnd, from, 0, 1, 3);
result = array_printdata(hnd);
array_delete(hnd);
array_delete(from);

result:

5; 0x01, 0x02, 0x03, 0x04, 0x05
0
3; 0x02, 0x03, 0x04

See also

array_new, array_delete, array_printdata, array_setdata