Copies data from an array into a Windows memory buffer.
C/C++
int cbWinArrayToBuf(unsigned short *DataArray, int MemHandle, long FirstPoint, long Count)
Visual Basic
Function cbWinArrayToBuf(DataArray%, ByVal MemHandle&, ByVal FirstPoint&, ByVal Count&) As Long
DataArray
The array containing the data to be copied.
MemHandle
This must be a memory handle that was returned by cbWinBufAlloc() when the buffer was allocated. The data will be copied into this buffer.
FirstPoint
Index of first point in memory buffer where data will be copied to.
Count
Number of data points to copy.
long Count= 1000;
unsigned short *DataArray=NULL;
int MemHandle = 0;
/*allocate the buffer and cast it to an unsigned short*/
MemHandle = cbWinBufAlloc(Count);
DataArray = (unsigned short*)MemHandle;
/*calculate and store the waveform*/
for(int i=0; i<Count; ++i)
DataArray[i] = 2047*(1.0 + sin(6.2832*i/Count));
/*output the waveform*/
cbAOutScan(......,MemHandle,...);
/*free the buffer and NULL the pointer*/
cbWinBufFree(MemHandle);
DataArray = NULL;