# FileRead()

This method reads data from a streamer file, and returns the data in a one-dimensional or two-dimensional array.

When FileAInScan() or FilePretrig() fills the streamer file, this method returns the content of that file. Refer to information on your board in the Universal Library User's Guide to determine if your board supports FileAInScan() and/or FilePreTrig().

Member of the MccService class.

## Function Prototype

VB .NET

Public Shared Function FileRead(ByVal fileName As String, ByVal firstPoint As Integer, ByRef numPoints As Integer, ByVal dataBuffer As Short()) As MccDaq.ErrorInfo

Public Shared Function FileRead(ByVal fileName As String, ByVal firstPoint As Integer, ByRef numPoints As Integer, ByVal dataBuffer As System.UInt16()) As MccDaq.ErrorInfo

Public Shared Function FileRead(ByVal fileName As String, ByVal firstPoint As Integer, ByRef numPoints As Integer, ByVal dataBuffer As System.double(,)) As MccDaq.ErrorInfo

C# .NET

public MccDaq.ErrorInfo FileRead(string fileName, int firstPoint, ref int numPoints, short[] dataBuffer)

public MccDaq.ErrorInfo FileRead(string fileName, int firstPoint, ref int numPoints, ushort[] dataBuffer)

public MccDaq.ErrorInfo FileRead(string fileName, int firstPoint, ref int numPoints, double[,] dataBuffer)

##### 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

Returns a one-dimensional array of short values:

Public Shared Function FileRead(ByVal fileName As String, ByVal firstPoint As Integer, ByRef numPoints As Integer, ByRef dataBuffer As Short) As MccDaq.ErrorInfo

Returns a one-dimensional array of System.UInt16 values:

Public Shared Function FileRead(ByVal fileName As String, ByVal firstPoint As Integer, ByRef numPoints As Integer, ByRef dataBuffer As System.UInt16) As MccDaq.ErrorInfo

Returns a two-dimensional array of double values:

Public Shared Function FileRead(ByVal fileName As String, ByVal firstPoint As Integer, ByRef numPoints As Integer, ByRef dataBuffer As Double(,), ByVal numChannels As Integer) As MccDaq.ErrorInfo

C# .NET

Returns a one-dimensional array of short values:

public static MccDaq.ErrorInfo FileRead(string fileName, int firstPoint, ref int numPoints, out short dataBuffer)

Returns a one-dimensional array of System.UInt16 values:

public static MccDaq.ErrorInfo FileRead(string fileName, int firstPoint, ref int numPoints, out ushort dataBuffer)

Returns a two-dimensional array of double values:

public static MccDaq.ErrorInfo FileRead(string fileName, int firstPoint, ref int numPoints, out double dataBuffer[,], int numChannels)

## Parameters

fileName

The name of the streamer file to read.

firstPoint

The index of the first point to read.

numPoints

The number of points to read in the file.

dataBuffer

A reference to the array in the data buffer that the data is read into.

numChannels

The number of channels to read into dataBuffer.

## Returns

- An ErrorInfo object that indicates the status of the operation.
- dataBuffer – the data read from a file.
- numPoints – number of points actually read. numPoints may be less than the requested number of points if an error occurs.

## Notes

- Data format:

The data is returned as 16-bits. The 16-bits may represent 12 bits of analog, 12-bits of analog plus 4 bits of channel, or 16-bits of analog data.

- Loading portions of files:

The file may contain more data than can fit in dataBuffer. Use numPoints and firstPoint to read a selected piece of the file into dataBuffer. Call FileGetInfo() first to find out how many points are in the file.