ACOPY( ) Function

Example   See Also

Copies elements from one array to another array.

Syntax

ACOPY(SourceArrayName, DestinationArrayName
  [, nFirstSourceElement [, nNumberElements [, nFirstDestElement ]]])

Returns

Numeric

Arguments

SourceArrayName, DestinationArrayName

Specifies the source array SourceArrayName from which elements are copied one-to-one to the destination array DestinationArrayName. The elements in the source array replace the elements in the destination array.

The arrays can be one- or two-dimensional. If the destination array doesn't exist, Visual FoxPro automatically creates it. In such a case, the size of the destination array will be the same as that of the source array.

Note   You can refer to an element in a two-dimensional variable array in two ways: The first uses two subscripts to specify the row and column position of the element in the array; the other uses a single-element number. This function and others that manipulate two-dimensional arrays require single-element numbers (here, nFirstSourceElement and nFirstDestElement). Use AELEMENT( ) to return the proper element number for a two-dimensional array from its row and column subscripts.

nFirstSourceElement

Specifies the first element number in the source array to be copied; inclusive (element number nFirstSourceElement is included in the copying). If nFirstSourceElement isn't included, copying begins with the first element in the source array.

nNumberElements

Specifies the number of elements copied from the source array. If nNumberElements is –1, all elements of the source array beginning with element nFirstSourceElement are copied.

nFirstDestElement

Specifies the first element in the destination array to be replaced.

Remarks

ACOPY( ) returns the number of elements copied to the destination array.