Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)
Guardian Native C Library Calls (s) scanf(3)
Conversion Specifications
Each conversion specification in the format parameter has the following syntax:
%[digit$][*][width][sizecode]convcode
• The character % (percent sign) or %digit$.
The scanf() function can handle a format string that enables the system to process an
element of the input stream for storage at a specific pointer location. In such a case, the
normal conversion specifier % (percent sign) is replaced by %digit$, where digit is a
decimal number in the range 1 through NL_ARGMAX. Conversion is then applied to
the specified pointer, rather than to the next unused pointer.
This variable ordering feature provides for the definition of format strings in an order
appropriate to specific languages. If this feature is used, it must be specified for all
conversions in format except for conversion specifications that do not have correspond-
ing pointers (that is, conversion specifications with the * [asterisk] assignment suppres-
sion character and %% conversion specifications).
If more than one conversion specification specifies the same value for digit, the results of
the function are undefined.
• The optional assignment suppression character * (asterisk).
• An optional decimal digit string width that specifies the maximum field width.
• An optional sizecode indicating the size of the receiving variable for some values of
convcode. The sizecode can be h, l, ll,orL, as follows:
— An h followed by a d, i, o, u,orx conversion code character indicates that the
receiving variable is treated as a short int or unsigned short int.
— An l followed by a d, i, o, u,orx conversion code character indicates that the
receiving variable is treated as a long int or unsigned long int.
— An l followed by an e, f,org conversion code character indicates that the receiv-
ing variable is treated as a double instead of a float.
— An ll followed by a d, i, o, u,orx conversion code character indicates that the
receiving variable is treated as a long long int or unsigned long long int.
— An ll followed by an e, f,org conversion code character indicates that the
receiving variable is treated as a double instead of a float.
— An L followed by an e, f,org conversion code character indicates that the
receiving variable is treated as a long double.
— An L followed by a d, i, n, o,orx conversion code character indicates that the
receiving variable is treated as a long long, which is a 64-bit integer data type.
• A conversion code character convcode that specifies the type of conversion to be
applied:
% Accepts a single % (percent sign) input at this point; no assignment is
done.
527192-005 Hewlett-Packard Company 6−5