User`s guide
52 Agilent VISA User’s Guide
3 Programming with VISA
char data[180];
viScanf(vi, "%t", data);
Formatted I/O Buffers
The VISA software maintains both a read and write buffer
for formatted I/O operations. Occasionally, you may want to
control the actions of these buffers. You can modify the size
of the buffer using the viSetBuf function. See the VISA
Online Help for more information on this function.
The write buffer is maintained by the viPrintf or viQueryf
(writeFmt) functions. The buffer queues characters to send
to the device so that they are sent in large blocks, thus
increasing performance. The write buffer automatically
flushes when it sends a newline character from the format
string. It may occasionally be flushed at other
non- deterministic times, such as when the buffer fills.
When the write buffer flushes, it sends its contents to the
device. If you set the VI_ATTR_WR_BUF_OPER_MODE
attribute to VI_FLUSH_ON_ACCESS, the write buffer will
also be flushed every time a viPrintf or viQueryf operation
completes. See “VISA Attributes” in this chapter for
information
on setting VISA attributes.
The read buffer is maintained by the viScanf and viQueryf
(readFmt) functions. It queues the data received from a
device until it is needed by the format string. Flushing the
read buffer destroys the data in the buffer and guarantees
that the next call to viScanf or viQueryf reads data directly
from the device rather than data that was previously
queued.
If you set the VI_ATTR_RD_BUF_OPER_MODE attribute to
VI_FLUSH_ON_ACCESS, the read buffer will be flushed
every time a viScanf or viQueryf operation completes. See
“VISA Attributes” in this chapter for information on setting
VISA attributes.