viSPrintf

NI-VISA

viSPrintf

Purpose

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

C Syntax

ViStatus viSPrintf(ViSession vi, ViPBuf buf, ViString writeFmt, ...)

Visual Basic Syntax

N/A

Resource Classes

GPIB INSTR, GPIB INTFC, GPIB-VXI INSTR, Serial INSTR, TCPIP INSTR, TCPIP SOCKET, 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.

...

IN

Parameters to 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

The viSPrintf() operation is similar to viPrintf(), except that the output is not written to the device; it is written to the user-specified buffer. This output buffer will be 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

viSScanf

viVPrintf

viVSPrintf