win_buf_to_array_32()

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

Prototype

win_buf_to_array_32(memhandle, data_array, first_point, count)

Parameters

memhandle (int)

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

data_array (POINTER(c_ulong))

The C array that the data is copied to.

first_point (int)

Index of the first point in the memory buffer that data is copied from

count (int)

The number of data points to copy.

Notes

From pyul import ul
count = 1000

# Allocate the buffer and cast it to an unsigned short
memhandle = ul.win_buf_alloc_32(count)
data_array = ctypes.cast(memhandle, ctypes.POINTER(ctypes.c_ulong))


# Run the input scan
ul.a_in_scan(0, 0, 0, count, 100, ULRange.BIP5VOLTS, memhandle, 0)


# Print the results
for i in range(0, count):

print("Data[" + str(i) + "] = " + str(data_array[i]) + "\n")


# Free the buffer and set the data_array to None
ul.win_buf_free(memhandle)
data_array = None