HP-UX Reference (11i v2 04/09) - 3 Library Functions N-Z (vol 7)

s
scanf(3S) scanf(3S)
hL An extended type is expected; the corresponding argument should be an
extended
pointer which is the 80-bit IEEE-754 double-extended type in the Itanium architecture;
should be used with the floating-point specifiers
a, A, e, E, f, g, and G.
n Cause the total number of bytes (including white space) scanned since the function call
to be stored; the corresponding argument should be an integer pointer. No input is
consumed. The function return value does not include
%n assignments in the count of
successfully matched and assigned input items.
a,A,e,E,f,g,G
A floating-point number is expected; the next field is converted accordingly and stored
through the corresponding argument, which should be a pointer to a float. The input
format for floating-point numbers is an optionally signed string of digits, possibly con-
taining a radix character, followed by an optional exponent field consisting of an
E or
an
e, followed by an optional +
, -, or space, followed by an integer. For Itanium(R)-
based systems only, hexadecimal floating-point input also is accepted: the format is an
optionally signed string of hexadecimal digits, possibly containing a radix character,
followed by an optional binary exponent field (indicating the power of two by which the
significand part is to be scaled) consisting of a
P or a p, followed by an optional +, -,
or space, followed by a decimal integer. The conversion characters
A, E, and G behave
the same as, respectively,
a, e, and g. The a
, A, e, E, f, g, and G conversions will con-
vert the string
inf (case insensitive) or the string infinity (case insensitive) to the
appropriate floating point infinity value (single, double, or quadruple precision, as
specified by the conversion precision modifier). The a, A, e,
E, f, g, and G conversions
will convert the string
nan (case insensitive) to the appropriate floating point NaN
value (single, double, or quadruple precision, as specified by the conversion precision
modifier).
c A character is expected; the corresponding argument should be a character pointer.
The normal skip-over-white-space is suppressed in this case; to read the next non-
space character, use
%1s. If a field width is given, the corresponding argument refers
to a character array; the indicated number of characters is read.
If an
l (ell) qualifier is present, the input is a sequence of characters that begins in the
initial shift state. Each character in the sequence is converted to a wide-character as if
by a call to the mbrtowc() function, with the conversion state described by an
mbstate_t object initialized to zero before the first character is converted. The
corresponding argument must be a pointer to an array of wchar_t large enough to
accept the resulting sequence of wide-characters. No null wide-character is added.
The normal skip-over-white-space is suppressed in this case; to read the next non-
space character, use %1S. If a field width is given, the corresponding argument refers
to a wide character array; the indicated number of characters is read and converted.
C Same as lc.
s A character string is expected; the corresponding argument should be a character
pointer pointing to an array of characters large enough to accept the string and a ter-
minating \0, which is added automatically. The input field is terminated by a white-
space character. scanf() cannot read a null string.
If an
l (ell) qualifier is present, the input is a sequence of characters that begins in the
initial shift state. Each character is converted to a wide-character as if by a call to the
mbrtowc() function, with the conversion state described by an mbstate_t object
initialized to zero before the first character is converted. The corresponding argument
must be a pointer to an array of wchar_t large enough to accept the sequence and
the terminating null wide-character, which will be added automatically. The input
field is terminated by a white-space character. scanf() cannot read a null string.
S Same as ls.
[ Indicates string data and the normal skip-over-leading-white-space is suppressed. The
left bracket is followed by a set of characters, called the scanset , and a right bracket;
the input field is the maximal sequence of input characters consisting entirely of char-
acters in the scanset. The circumflex (ˆ), when it appears as the first character in the
scanset, serves as a complement operator and redefines the scanset as the set of all
characters not contained in the remainder of the scanset string. Construction of the
scanset follows certain conventions. A range of characters may be represented by the
HP-UX 11i Version 2: September 2004 2 Hewlett-Packard Company Section 3943