Formatting and I/O Library Chapter 2
LabWindows/CVI Standard Libraries 2-46 © National Instruments Corporation
If the p
n
modifier is omitted, a default of p6 is used. The p modifier is valid for
sources only.
en Specify as Scientific Notation. The e floating-point modifier indicates that the
string representation of the floating-point value is in scientific notation. If omitted,
non-scientific notation is used.
n
is optional and specifies the number of digits to use
in the exponent. For example, %f[e2] causes 10.0 to be formatted as 1.0e+01. If
n
is omitted, a default of three is used. The e modifier is valid for sources only.
fSpecify as Floating Point. The f floating-point modifier indicates that the string
representation of the floating-point value is in non-scientific notation. This is the
default even when the f modifier is not present.
xDiscard Terminator. The x floating-point modifier 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, %3f[x] reads three floating-
point numbers, disregarding the terminator character which appears after each one;
this specifier could then be used to scan the string 3.5, 7.6, -32.4.
dDiscard Data. When applied to a target specifier, the d modifier indicates 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.
Scanning String Modifiers (%s)
in Specify Array Offset. The i string modifier specifies an offset within a string. It
indicates the location within the string where processing is to begin.
n
is the zero-
based index of the first byte to process. Thus, %s[i2] applied to a target string
begins placing data in the third byte of the string.
aAppend. When applied to a target format specifier, the a string modifier specifies
that all formatted data be appended to the target string, beginning at the first
occurrence of an ASCII NUL in the target string.
wn Specify String Size. When modifying a source format specifier, the w string modifier
specifies the maximum number of bytes from the source string to be used for filling
the target arguments. You can enter any non-negative value here, the default being
zero, which indicates that the entire string can be used. (For ScanFile and
ScanIn, the entire source string is consumed even if the w modifier restricts the
number of bytes used to fill in the target arguments.)
When modifying a target format specifier, the w modifier specifies the exact number
of bytes to store in the string, excluding the terminating ASCII NUL. If
n
is zero or
omitted, as many bytes are stored as are called for by the sources. When
n
is greater