Chapter 2 Formatting and I/O Library
© National Instruments Corporation 2-37 LabWindows/CVI Standard Libraries
Note: When using both the b
n
and o
n
modifiers on an integer specifier, the b
n
modifier
must be first.
Formatting Floating-Point Modifiers (%f)
bn Specify Length. The b floating-point modifier specifies the length of the
floating-point argument, or the length of an individual array element, in bytes. The
default length is 8 bytes; therefore, double-precision values do not need this modifier.
Single-precision floating-point values are indicated by b4. 8 and 4 are the only valid
values for
n
.
in
Specify Array Offset. You use the i modifier to specify an offset within a
floating-point 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, %10f[i2] applied to a source floating-point array reads the 10 floating-point
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 Floating-Point Array. The z floating-point modifier indicates that
the data type of the corresponding argument is a string. Nevertheless, the data in the
string is treated as a floating-point array. The z modifier is valid only if rep is
present.
wn Specify String Size. The w floating-point modifier specifies the exact number of
bytes in which to store a string representation of the floating-point argument, in the
event that the value is converted to a string format. Any non-negative value can be
entered here. If n is less than the number of digits required to represent the
floating-point number, an asterisk (*) will be inserted into the string to signify an
overflow. The default for n is zero, which indicates that the value can occupy
whatever space is necessary.
pn Specify Precision. The p floating-point modifier specifies the number of digits to the
right of the decimal point in a string representation of the floating-point number. You
can lose significant digits by attempting to conform to the precision specification. If
the p
n
modifier is omitted, the default value is p6.
en Specify as Scientific Notation. The e floating-point modifier specifies that a value
be converted to string format in scientific notation. If omitted, floating-point notation
is used.
n
is optional and specifies the number of digits in the exponent. For
example, %f[e2] formats 10.0 as 1.0e+01. If
n
is omitted, a default of three is used.
fSpecify as Floating-Point Notation. The f floating-point modifier specifies the
value to be converted to string format in floating-point notation. This is the default.