# WinArrayToBuf()

Copies data from a one-dimensional or two-dimensional array into a Windows memory buffer.

Member of the MccService class.

## Function Prototype

VB .NET

Copies data from a one-dimensional array of short values:

Public Shared Function WinArrayToBuf(ByVal dataArray As Short(), ByVal memHandle As IntPtr, ByVal firstPoint As Integer, ByVal numPoints As Integer) As MccDaq.ErrorInfo

Copies data from a one-dimensional array of System.UInt16 values:

Public Shared Function WinArrayToBuf(ByVal dataArray As System.UInt16(), ByVal memHandle As IntPtr, ByVal firstPoint As Integer, ByVal numPoints As Integer) As MccDaq.ErrorInfo

Copies data from a two-dimensional array of double values:

Public Shared WinArrayToBuf(ByVal dataArray As Double(,), ByVal memHandle As IntPtr, ByVal firstPoint As Integer, ByVal numPoints As Integer, ByVal numChannels As Integer) As MccDaq.ErrorInfo

C# .NET

Copies data from a one-dimensional array of short values:

public MccDaq.ErrorInfo WinArrayToBuf(short[] dataArray, IntPtr memHandle, int firstPoint, int numPoints)

Copies data from a one-dimensional array of System.UInt16 values:

public MccDaq.ErrorInfo WinArrayToBuf(ushort[] dataArray, IntPtr memHandle, int firstPoint, int numPoints)

Copies data from a two-dimensional array of double values:

public MccDaq.ErrorInfo WinArrayToBuf(double[,] dataArray, IntPtr memHandle, int firstPoint, int numPoints, int numChannels)

##### Deprecated methods

The following methods are deprecated, and should only be used for legacy applications. The methods above are preferred, and must be used for 64-bit application development.

VB .NET

Copies data from a one-dimensional array of short values:

Public Shared Function WinArrayToBuf(ByRef dataArray As Short, ByVal memHandle As Integer, ByVal firstPoint As Integer, ByVal numPoints As Integer) As MccDaq.ErrorInfo

Copies data from a one-dimensional array of System.UInt16 values:

Public Shared Function WinArrayToBuf(ByRef dataArray As System.UInt16, ByVal memHandle As Integer, ByVal firstPoint As Integer, ByVal numPoints As Integer) As MccDaq.ErrorInfo

Copies data from a two-dimensional array of double values:

Public Shared WinArrayToBuf(ByRef dataArray As Double(,), ByVal memHandle As Integer, ByVal firstPoint As Integer, ByVal numPoints As Integer, ByVal numChannels As Integer) As MccDaq.ErrorInfo

C# .NET

Copies data from a one-dimensional array of short values:

public static MccDaq.ErrorInfo WinArrayToBuf(ref short dataArray, int memHandle, int firstPoint, int numPoints)

Copies data from a one-dimensional array of System.UInt16 values:

public static MccDaq.ErrorInfo WinArrayToBuf(ref ushort dataArray, int memHandle, int firstPoint, int numPoints)

Copies data from a two-dimensional array of double values:

public static MccDaq.ErrorInfo WinArrayToBuf(ref double[,] dataArray, int memHandle, int firstPoint, int numPoints, int numChannels)

## Parameters

dataArray

The array containing the data to be copied. The first dimension should equal the number of channels. The second dimension should equal the number of points/channel.

memHandle

This must be a memory handle that was returned by WinBufAllocEx() when the buffer was allocated. The data will be copied into this buffer.

firstPoint

Index of the first point in the memory buffer where data will be copied to.

numPoints

Number of data points to copy from dataArray.

numChannels

Number of channels to copy from dataArray.

## Returns

- An ErrorInfo object that indicates the status of the operation.

## Notes

- This method copies data from an array to a Windows global memory buffer. This would typically be used to initialize the buffer with data before doing an output scan. You can use the firstPoint and numPoints parameters to fill a portion of the buffer. This is useful if you want to send new data to the buffer after a Background + Continuous output scan has been started, for example during circular buffering.