WriteFromFile

IVI Library

Ivi_WriteFromFile

Usage

ViStatus Ivi_WriteFromFile(ViSession vi, ViChar filename[ ], ViInt32 writeNumberOfBytes, ViInt32 byteOffset, ViInt32* returnCount);

Purpose

This function reads data from a file you specify and writes it to an instrument using VISA I/O. Use this function internally in your instrument driver.

The function assumes that the IVI_ATTR_IO_SESSION attribute for the IVI session you specify holds a valid VISA session for the instrument.

The function opens the file in binary mode.

The function calls Ivi_SetNeedToCheckStatus with VI_TRUE.

Parameters

Name Type Description
vi ViSession

The ViSession handle that you obtain from Ivi_SpecificDriverNew. The handle identifies a particular IVI session.

filename ViChar[ ]

Specify the pathname of the file from which to write the data. You can specify an absolute pathname, a relative pathname, or a simple filename. The function treats relative pathnames and simple filenames as relative to the current working directory.

If you enter a literal string in this parameter under Windows, be sure to use double backslashes to represent one backslash in the pathname.

writeNumberOfBytes ViInt32

Specify the maximum number of bytes to read from the file and write to the instrument.

byteOffset ViInt32

Specify the byte offset in the file at which to start reading.

If the file contains header information that you do not want to write to the instrument, you can skip over the header by passing the number of bytes in the header for this parameter.

returnCount ViInt32*

Returns the number of bytes the function successfully writes from the file.

Return Value

Contains the status code that the function call returns. IVI engine functions can return error and warning values from several sets of status codes. Some status codes are unique to the IVI engine. Other status codes are the same codes that VISA Library functions return. Still others are error or warning values that functions in specific instrument drivers return. Each set of status codes has its own numeric range.

Regardless of the source of the status code, 0 always indicates success, a positive value indicates a warning, and a negative value indicates an error.

Related Topic

IVI Status Codes