viQueryf

Agilent VISA.NET

viQueryf

Syntax

viQueryf(ViSession vi, ViString writeFmt, ViString readFmt, arg1, arg2,...);

Description

This function performs a formatted write and read through a single operation invocation. This function provides a mechanism of "Send, then receive" typical to a command sequence from a commander device. In this manner, the response generated from the command can be read immediately.

This function is a combination of the viPrintf and viScanf functions. The first n arguments corresponding to the first format string are formatted by using the writeFmt string and then sent to the device. The write buffer is flushed immediately after the write portion of the operation completes. After these actions, the response data is read from the device into the remaining parameters (starting from parameter n + 1) using the readFmt string. This function returns the same VISA status codes as viPrintf, viScanf, and viFlush.

Note: VISA functions that take a variable number of parameters (e.g., viPrintf, viScanf, and viQueryf) are not callable from Visual Basic. Use the corresponding viVPrintf, viVScanf and viQueryf functions instead.

Parameters

Name

Dir

Type

Description

vi

IN

ViSession

Unique logical identifier to a session.

writeFmt

IN

ViString

ViString describing the format of the write arguments.

readFmt

IN

ViString

ViString describing the format of the read arguments.

arg1, arg2

IN OUT

N/A

Parameters on which write and read format strings are applied.

Return Values 

Type ViStatus

This is the function return status. It returns either a completion code or an error code as follows.

Completion Code

Description

VI_SUCCESS

Successfully completed the query operation.

Error Codes

Description

VI_ERROR_ALLOC

The system could not allocate a formatted I/O buffer because of insufficient resources.

VI_ERROR_INV_FMT

A format specifier in the writeFmt or readFmt string is invalid.

VI_ERROR_INV_SESSION
VI_ERROR_INV_OBJECT

The given session or object reference is invalid (both are the same value).

VI_ERROR_IO

Could not perform read/write operation because of I/O error.

VI_ERROR_NSUP_FMT

The format specifier is not supported for current argument type.

VI_ERROR_RSRC_LOCKED

Specified operation could not be performed because the resource identified by vi has been locked for this kind of access.

VI_ERROR_TMO

Timeout occurred before read/write operation completed.

See Also

viPrintf, viScanf, viVQueryf