# win_buf_to_array_64()

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

## Prototype

win_buf_to_array_64(memhandle, data_array, first_point, count)

## Parameters

memhandle (int)

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

data_array (POINTER(c_ulonglong))

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

- This function copies data from a Windows global memory buffer to an array. This would typically be used to retrieve data from the buffer after executing an input scan function.
- Using the first_point and count parameter it is possible to copy only a portion of the buffer to the array. This can be useful if you want foreground code to manipulate previously collected data while a BACKGROUND scan continues to collect new data.
- Although this function is available to Python programs, it is not necessary, since it is possible to manipulate the memory buffer directly by casting the memhandle returned from win_buf_alloc_64() to the appropriate type. This method avoids having to copy the data from the memory buffer to an array.

Refer to the following example:

From pyul import ul
count = 1000

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

# Run the input scan
ul.c_in_scan(0, 0, 0, count, 100, 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