viQueryf

NI-VISA

viQueryf

Purpose

Performs a formatted write and read through a single call to an operation.

C Syntax

ViStatus viQueryf(ViSession vi, ViString writeFmt, ViString readFmt,...)

Visual Basic Syntax

N/A

Resource Classes

GPIB INSTR, GPIB-VXI INSTR, Serial INSTR, TCPIP INSTR, TCPIP SOCKET, VXI INSTR

Parameters

Name Direction Description

vi

IN

Unique logical identifier to a session.

writeFmt

IN

String describing the format of write arguments.

readFmt

IN

String describing the format of read arguments.

...

IN/OUT

Parameters to which write and read format strings are applied.

Return Values

Completion Codes Description

VI_SUCCESS

Successfully completed the query operation.

 

Error Codes Description

VI_ERROR_INV_OBJECT

The given session reference is invalid.

VI_ERROR_IO

Could not perform Read/Write operation because of I/O error.

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.

VI_ERROR_INV_FMT

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

VI_ERROR_NSUP_FMT

The format specifier is not supported for current argument type.

VI_ERROR_ALLOC

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

Description

This operation 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 operation is a combination of the viPrintf() and viScanf() operations. The first n arguments corresponding to the first format string are formatted by using the writeFmt string, 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.

Note  Because the prototype for this function cannot provide complete type-checking, remember that all output parameters must be passed by reference.

Related Topics

INSTR Resource

SOCKET Resource

viPrintf

viScanf

viVQueryf