Chapter 2 Formatting and I/O Library
© National Instruments Corporation 2-43 LabWindows/CVI Standard Libraries
freal number. As a source or target specifier, this indicates that the corresponding
parameter is a real number, or if rep is present, a real array. As a source specifier in
conversions to string formats, the floating-point value is converted into ASCII form. As
a target specifier in conversions from string format, bytes of the source parameter are
consumed as long as they match the pattern of floating-point ASCII numbers, or until the
end of the string is encountered. The scanned characters are converted to a floating-point
value and placed into the corresponding floating-point or floating-point array target
parameter. If the format is repeated, the operation is repeated the appropriate number of
times with successive elements of the array parameter. The pattern for floating-point
ASCII numbers is an optional sign (+ or -), a series of one or more decimal digits
possibly containing a decimal point, and an optional exponent consisting of an E or e
followed by an optionally signed decimal integer value.
ccharacter. As a source specifier, this indicates that the source parameter is an integer with
one significant byte or, if rep is present, an array of 1-byte integers. As a target specifier
this indicates that a byte of the source parameter is to be consumed, and the scanned
character placed directly into the corresponding target parameter, which is an integer
passed by reference. If the format is repeated, this operation is repeated the appropriate
number of times and the results stored into successive elements of the integer array.
Scanning Modifiers
modifiers are optional codes used to describe the nature of the source or target data. If you
use them, you must enclose the modifiers in square brackets and place them immediately after
the format code they modify. If one format specifier requires more than one modifier, enclose all
modifiers in the same set of brackets. There is a different set of modifiers for each possible
format specifier.
Scanning Integer Modifiers (%i, %d, %x, %o, %c)
bn Specify Length. The b integer modifier specifies the length of the integer argument,
or the length of an individual integer array element, in bytes. The default length is
4 B; therefore, simple 4 B integers do not need this modifier. The modifier b2
represents short integers. The modifier b1 represents single-byte integers.
in Specify Array Offset. Use the i integer modifier to specify an offset within an
integer array argument. It indicates the location within the array where processing is
to begin.
n
is the zero-based index of the first element to process. Thus, %10d[i2]
applied to a source integer array reads the 10 integer values from the third through the
twelfth elements of the array. The i modifier is valid only if rep is present. If the
i modifier is used with the z modifier, then n is in terms of bytes.
zTreat String as Integer Array. The z integer modifier indicates that the data type of
the corresponding argument is a string. Nevertheless, the data in the string is treated
as an integer array. The z modifier is valid only if rep is present.