viBufWrite

NI-VISA 15.0 Help

Edition Date: June 2015

Part Number: 370131S-01

»View Product Info

Purpose

Writes data to a formatted I/O write buffer synchronously.

C Syntax

ViStatus viBufWrite(ViSession vi, ViBuf buf, ViUInt32 count, ViPUInt32 retCount)

Visual Basic Syntax

viBufWrite&(ByVal vi&, ByVal buf$, ByVal count&, retCount&)

Resource Classes

GPIB INSTR, GPIB INTFC, 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

IN

Location of a block of data.

count

IN

Number of bytes to be written.

retCount

OUT

Number of bytes actually transferred.

Return Values

Completion Codes Description

VI_SUCCESS

Operation completed successfully.

Error Codes Description

VI_ERROR_INV_OBJECT

The given session reference is invalid.

VI_ERROR_NSUP_OPER

The given vi does not support this operation.

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 operation completed.

VI_ERROR_INV_SETUP

Unable to start write operation because setup is invalid (due to attributes being set to an inconsistent state).

VI_ERROR_IO

An unknown I/O error occurred during transfer.

Description

The viBufWrite() operation is similar to viWrite() and does not perform any kind of data formatting. It differs from viWrite() in that the data is written to the formatted I/O write buffer—the same buffer used by viPrintf() and related operations—rather than directly to the device. You can intermix this operation with viPrintf(), but you should not mix it with viWrite().

If this operation returns VI_ERROR_TMO, the write buffer for the specified session is cleared.

VI_NULL is a special value for the retCount parameter. If you pass VI_NULL for retCount, the number of bytes transferred is not returned. You may find this useful if you need to know only whether the operation succeeded or failed.

Note Note  The retCount parameter always is valid on both success and error.


Related Topics

INSTR Resource

INTFC Resource

SERVANT Resource

SOCKET Resource

viBufRead

viWrite

WAS THIS ARTICLE HELPFUL?

Not Helpful