cbWinBufToArray32()

Copies 32-bit data from a Windows memory buffer into an array.

Function Prototype

C/C++

int cbWinBufToArray32(int MemHandle, unsigned long* DataArray, long FirstPoint, long Count)

Visual Basic

Function cbWinBufToArray32(ByVal MemHandle&, DataArray&, ByVal FirstPoint&, ByVal Count&) As Long

Arguments

MemHandle

The memory handle that was returned by cbWinBufAlloc32() when the buffer was allocated. The buffer should contain the data that you want to copy.

DataArray

The array that the data is copied to.

FirstPoint

The index of the first point in the memory buffer that data is copied from.

Count

The number of data points to copy.

Returns

Notes

Refer to the following example:

/*declare and initialize the variables*/
long Count = 1000;
unsigned short *DataArray = NULL;
int MemHandle = 0;



/*allocate the buffer and cast it to a pointer to an unsigned long*/
MemHandle = cbWinBufAlloc32(Count);
DataArray = (unsigned long*)MemHandle;


/*scan in the data*/
cbCInScan(......,MemHandle,...);



/*print the results*/
for(int i=0; i<Count; ++i)

printf("Data[%d]=%d\n", i, DataArray[i]);




/*free the buffer and NULL the pointer*/
cbWinBufFree(MemHandle);
DataArray = NULL;