Functions > di_copy_array

Syntax 

The di_copy_array function copies the contents of a user specified array into the output buffer. The size of the buffer is set by di_buffer_alloc.

Syntax 

int di_copy_array (buf_index, source, number);

unsigned buf_index;

/* specifies the offset from the first element in the buffer */

int _huge *source;

/* specifies source array name */

unsigned number;

/* specifies how many array elements to copy to the output buffer */

Parameters

buf_index

buf_index specifies the offset from the first element in the buffer. If an offset of zero is specified data is copied to the output buffer starting with the very first element in the array. Specifying an offset of 10 will start the copy process with the tenth value of the output buffer (etc.).

_huge *source

Specifies the source array name. The _huge pointer allows C programmers to specify a source array larger than 64k bytes.

number

Specifies how many array elements to copy to the output buffer.

Return Value

DI_NO_ERR No error

Dependencies

di_buffer_alloc

Remarks

This function also supports buffer wrapping (i.e., if buf_index and number exceed the buffer size in words, the copy process continues to the start of the buffer). Thedi_buffer_status function can be used to compute buf_index, which must be between 0 and (buffer size - 1). Although number may be as large as the buffer size, active scanning may concurrently output values starting at the index returned by di_buffer_status.

Sample Code

Declare Sub di_copy_array Lib "200SDK.DLL" (ByVal buf_index%, source%(), ByVal number%)

Dim out_buff%

'offset in the output buffer

Dim analog_out%(1000)

'array used to store analog out

Dim number%

'number of samples to copy

Sub Form_Load ()

' This copies the first 500 elements of analog_out to the output buffer at offset 0

buf_index = 0

number = 500

di_copy_array buf_index,analog_out(0),number

End Sub

 

Copyright © DATAQ Instruments, Inc.