National Instruments 320682C Musical Toy Instrument User Manual


 
Formatting and I/O Library Chapter 2
LabWindows/CVI Standard Libraries 2-42 © National Instruments Corporation
formatcode is specified with one of the following codes:
s string. As a source or target specifier this indicates that the corresponding parameter is a
character string. As a source specifier the number of bytes of the source parameter that
are consumed depends on the target specifier. If the target specifier is %s, bytes are
consumed until a termination character is encountered (see the t modifier for strings for
more information on termination characters). If the target specifier is one of the numeric
formats, bytes are consumed as long as they correspond to the pattern for the particular
numeric item being converted. Leading spaces and tabs are skipped unless the y modifier
is used.
Note: When a target string is filled in, an ASCII NUL is always placed in the string
after the last byte.
l string. This is allowed only as a source specifier. It is the same as the %s specifier,
except that bytes from the source argument are to be consumed only until a linefeed is
encountered. Also, when modified with c as in %l[c], a comma is used as the target
string terminator in place of white space characters.
i integer. As a source or target specifier this indicates that the corresponding parameter is
an integer or, if rep is present, an integer array. As a source specifier in conversions to
string formats, the integer is converted into digits of the specified radix (default is
decimal). As a target specifier in conversions from string format, bytes of the source
parameter are consumed as long as they match the pattern of integer ASCII numbers in
the appropriate radix, or until the end of the string is encountered. The scanned
characters are converted to integer values and placed into the corresponding target
parameter, which is an integer or integer array passed by reference. If the format is
repeated, the operation is repeated the appropriate number of times with successive
elements of the integer array parameter.
The pattern for integer ASCII numbers depends on the radix of the number, and consists
of an optional sign (+ or -), followed by a series of one or more digits in the appropriate
radix. The decimal digits are 01234 56789. The octal digits are 01234567. The
hexadecimal digits are 0123456789ABCDEFabcdef.
x integer (hexadecimal). This specifier indicates a %i format with hexadecimal radix.
o integer (octal). This specifier indicates a %i format with octal radix.
d integer (decimal). This specifier indicates a %i format with decimal radix. Since
decimal is the default radix for integers, %d is equivalent to %i, and is included for
compatibility with the C scanf family of functions.