Formatting and I/O Library Chapter 2
LabWindows/CVI Standard Libraries 2-34 © National Instruments Corporation
Format specifiers describe the inputs and outputs of data transformations. Each format specifier
has the following form.
% [ rep ] formatcode [[ modifiers ]]
The character % introduces all format specifiers. rep indicates how many times the format
repeats with respect to the arguments. formatcode is a code character which indicates the
nature of the data items being formatted. modifiers is an optional bracket-enclosed sequence
of codes which further describe the data format.
Examples of format specifiers are as follows.
%s %100f %i[b2u]
Note: rep is not allowed when formatcode is s (string).
formatcode is specified with one of the following codes:
sstring. As a source or target specifier, this indicates that the corresponding parameter is a
character string. As a target specifier (the default if no target specifier is present), this
can mean that numeric source parameters become converted into an ASCII form for
inclusion in the target string. See the individual numeric formats, such as %i and %f, for
details of these conversions. Arrays of strings are not allowed. For example, %10s is not
a valid format string.
Note: When a target string is filled in, an ASCII NUL is always placed in the string
after the last byte.
iinteger. This source or target specifier indicates that the corresponding parameter is an
integer or, if rep is present, an integer array. The function performs conversions to
ASCII digits when converting to or from the string format %s. A modifier is available to
specify the radix to be used in such a conversion (default is decimal).
xinteger (hexadecimal). This source or target specifier indicates that the corresponding
parameter is an integer or, if rep is present, an integer array. The function performs
conversions to ASCII hexadecimal digits (0123456789abcdef) when converting to or
from the string format %s.
ointeger (octal). This source or target specifier indicates that the corresponding parameter
is an integer or, if rep is present, an integer array. The function performs conversions to
ASCII octal digits (01234567) when converting to or from the string format %s.
dinteger (decimal). This format specifier is identical to %i and is included for
compatibility with the C printf family of functions.