viVQueryf

Agilent VISA.NET

viVQueryf

Syntax

viVQueryf(ViSession vi, ViString writeFmt, ViString readFmt, ViVAList params);

Description

This function performs a formatted write and read through a single operation invocation. This function is similar to viQueryf, except that the ViVAList parameters list provides the parameters rather than the separate arg parameter list in viQueryf.

Using viVQueryf in Visual Basic 6

The viPrintf, viScanf, and viQueryf VISA functions take variable argument lists in C.  Some of viScanf's and viQueryf's variable arguments are references to primitive (byte, integer, long, float, etc.) types, meaning that the values themselves can be changed by the function.  There is no equivalent in VB6 for variable argument lists with reference arguments, so no direct translation is available.  Instead, use the 'V' form of these functions (viVPrintf, viVScanf, and viVQueryf),  in conjunction with the undocumented VB6 VarPtr function to create an array of pointers to arguments than can be passed to the VISA functions. See viVQueryf Example with String and Indefinite Length Block for sample code in VB6.

Parameters

Name

Dir

Type

Description

vi

IN

ViSession

Unique logical identifier to a session.

writeFmt

IN

ViString

The format string is applied to write parameters in ViVAList.

readFmt

IN

ViString

The format string to apply to read parameters in ViVAList.

params

IN OUT

ViVAList

A list containing the variable number of write and read parameters. The write parameters are formatted and written to the specified device. The read parameters store the data read from the device after the format string is applied to the data.

Return Values 

Type ViStatus

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

Completion Codes

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 string 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 function 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 expired before read/write operation completed.

See Also

viVPrintf, viVScanf, viQueryf
viVQueryf Example with String and Indefinite Length Block