Chapter 2 Formatting and I/O Library
© National Instruments Corporation 2-47 LabWindows/CVI Standard Libraries
than the number of bytes available from the source, the remaining bytes are filled
with ASCII NULs if the q modifier is used or blanks if the q modifier is not present.
When the w modifier is used in conjunction with the a modifier,
n
indicates the
number of bytes to append to the string excluding the terminating ASCII NUL.
If wn modifies a target string and
n
is larger than the number of bytes in the target
argument, the target argument is overwritten in compiled C.
qAppend NULs. When applied to a target string in conjunction with the w string
modifier, the q string modifier specifies that unfilled bytes at the end of the target
string be set to ASCII NULs instead of blanks.
yAppend with Spacing. When the source is a string and the y modifier is applied to a
target string format specifier, the target string is filled with bytes from the source
string without skipping leading spaces or tabs.
tn Terminate on Character. When applied to a source string, the t modifier specifies
that the source string is terminated on the first occurrence of the character
n
, where
n
is the ASCII value of the character. Thus, %s[t44] causes reading of the source
string to stop on an ASCII comma. More than one t modifier can occur in the same
specifier, in which case the string terminates when any of the terminators occur. If no
t modifier is present, reading of the source string stops on an ASCII NUL.
When applied to a target string that is being filled from a source string, the t modifier
specifies that filling of the target is terminated on the first occurrence of the character
n
, where
n
is the ASCII value of the character. Thus, %s[t59] causes reading of
the source string to stop on an ASCII semicolon. More than one t modifier can occur
in the same specifier, in which case filling of the target terminates when any of the
terminators occur. If no t modifier is present, filling of the target stops on any
whitespace character.
t- Terminate when Full. This is similar to t
n
, except that it specifies that there are no
terminating characters. When applied to a source string, t- specifies that reading of
the source string terminates when all of the targets are full or when the number of
bytes specified with the w modifier have been read. When applied to a target string,
t- specifies that filling of the target string terminates when the source is exhausted or
when the number of bytes specified with the w modifier have been placed into the
target.
t# Terminate on Number. This is equivalent to repeating the t modifier with the
ASCII values of the characters +, -, and 0 through 9. When applied to a source
(target), it specifies that reading of the source string (filling of the target string) be
terminated upon occurrence of a numeric expression. Using %s>%s[t#]%d with the
source string ab567, ab is placed in the first target and the integer 567 is placed in
the second target.