Formatting and I/O Library Chapter 2
LabWindows/CVI Standard Libraries 2-44 © National Instruments Corporation
rn Specify Radix. The r integer modifier specifies the radix of the integer argument,
which is important if the integer is converted from a string format. Legal radixes are
8 (octal), 10 (decimal, the default), 16 (hexadecimal), and 256 (a special radix
representing single 8-bit ASCII characters).
wn Specify String Size. The w integer modifier specifies the exact number of bytes
occupied by a string representation of the integer argument, in the event that the
integer is converted from a string format. You can enter any non-negative value here.
If n is less than the number of digits required to represent the integer, an asterisk (*)
will be inserted into the string to signify an overflow. The default for n is zero, which
indicates that the integer can occupy whatever room is necessary.
sSpecify as Two’s Complement. The s integer modifier indicates that the integer
argument is to be considered a signed two's complement number. This is the default
interpretation of integers, so the s modifier is not required.
uSpecify as Non-negative. The u integer modifier indicates that the integer is to be
considered a non-negative integer.
xDiscard Terminator. The x integer causes the character that terminated the numeric
data to be discarded. In this way, terminator characters can be skipped when reading
lists of numeric input. Thus, %3i[x] reads three integer numbers, disregarding the
terminator character which appears after each one. You can use this specifier to scan
the string 3, 7, -32.
dDiscard Data. When applied to a target specifier, the d integer modifier indicates
that there is no target argument to correspond to the target specifier. The data that
otherwise is placed in the target argument is discarded instead. The count returned by
the Scan/ScanFile/ScanIn functions will include the target specifier even if the
d modifier is used.
onnnn Specify Byte Ordering. The o integer modifier is used to describe the byte ordering
of raw data so that LabWindows/CVI can map it to the byte order appropriate for the
Intel (PC) or Motorola (SPARCstation) architecture. The number of
n
's must be
equal to the byte size of the integer argument as specified by the b
n
modifier, which
must precede the o modifier. In the case of a four-byte integer, o0123 indicates that
the bytes are in ascending order of precedence (Intel style), and o3210 indicates that
the bytes are in descending order of precedence (Motorola style).
In a Scan function, the buffer containing the raw instrument data should have the
o modifier describing the byte ordering. The buffer without the o modifier is
guaranteed to be in the mode of the host processor. LabWindows/CVI will reverse the
byte ordering of the buffer without the o modifier depending on which architecture
the program is running.
For example, if your GPIB instrument sends two-byte binary data in Intel byte order,
your code should appear as follows.