User`s guide

48 Agilent VISA User’s Guide
3 Programming with VISA
For viPrintf or viQueryf (writeFmt), you can use an
asterisk (*) in place of the integer to indicate that the
integer is taken from the next argument. For viScanf or
viQueryf (readFmt), you can use a # sign to indicate that
the next argument is a reference to the array size.
Sample: Using Array Size Modifier
This sample specifies a comma- separated list to be sent to
the session specified by vi:
int list[5]={101,102,103,104,105};
viPrintf(vi, "%,5d\n", list);
Sends: 101,102,103,104,105
Special Characters Special formatting character
sequences will send special characters. The following
describes the special characters and what will be sent.
The format string for viPrintf and viQueryf (writeFmt)
puts a special meaning on the newline character (\n). The
newline character in the format string flushes the output
buffer to the device.
All characters in the output buffer will be written to the
device with an END indicator included with the last byte
(the newline character). This means you can control at
what point you want the data written to the device. If no
newline character is included in the format string, the
characters converted are stored in the output buffer. It
will require another call to viPrintf, viQueryf (writeFmt),
or viFlush to have those characters written to the device.
This can be very useful in queuing up data to send to a
device. It can also raise I/O performance by doing a few
large writes instead of several smaller writes. The * while
using the viScanf functions acts as an assignment
suppression character. The input is not assigned to any
parameters and is discarded.
The grouping operator () in a regular expression has the
highest precedence, the + and * operators in a regular
expression have the next highest precedence after the