viVSPrintf

NI-VISA

viVSPrintf

Purpose

Converts, formats, and sends the parameters designated by params to a user-specified buffer as specified by the format string.

C Syntax

ViStatus viVSPrintf(ViSession vi, ViPBuf buf, ViString writeFmt, ViVAList params)

Visual Basic Syntax

viVSPrintf&(ByVal vi&, ByVal buf$, ByVal writeFmt$, params as Any)

Resource Classes

GPIB INSTR, GPIB INTFC, GPIB-VXI INSTR, Serial INSTR, TCPIP INSTR, TCPIP SOCKET, USB INSTR, USB RAW, VXI INSTR, VXI SERVANT

Parameters

Name Direction Description

vi

IN

Unique logical identifier to a session.

buf

OUT

Buffer where data is to be written.

writeFmt

IN

The format string to apply to parameters in ViVAList.

params

IN

A list containing the variable number of parameters on which the format string is applied. The formatted data is written to the specified buf.

Return Values

Completion Codes Description

VI_SUCCESS

Parameters were successfully formatted.

 

Error Codes Description

VI_ERROR_INV_OBJECT

The given session reference is invalid.

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_INV_FMT

A format specifier in the writeFmt string is invalid.

VI_ERROR_NSUP_FMT

A format specifier in the writeFmt string is not supported.

VI_ERROR_ALLOC

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

Description

This operation is similar to viVPrintf(), except that the output is not written to the device; it is written to the user-specified buffer. This output buffer is NULL terminated.

If this operation outputs an END indicator before all the arguments are satisfied, then the rest of the writeFmt string is ignored and the buffer string is still terminated by a NULL.

Note  The size of the buf parameter should be large enough to hold the formatted I/O contents plus the NULL termination character.

Related Topics

INSTR Resource

INTFC Resource

SERVANT Resource

SOCKET Resource

viPrintf

viSPrintf

viVPrintf

viVSScanf