Guardian C Library Calls Reference Manual

fscanf
3-64 128833Guardian TNS C Library Calls Reference Manual
Reference to Library Calls
Conversion Codes
As mentioned earlier, conv_code determines both how fscanf scans the input data
and what type of value it converts that data to. This list shows the conversion codes
and describes the scanning technique and data conversion specified by each code.
c
matches a sequence of width characters (1 if width is omitted). The
corresponding obj_ptr must be a pointer to char that points to the first
character of an array large enough to accommodate width elements. fscanf
does not append a null character to the input data.
d
matches an optionally signed decimal integer. The corresponding obj_ptr must
be a pointer to int.
e
matches an optionally signed floating-point number that is a valid floating-
point constant without a suffix. The corresponding obj_ptr must be a pointer
to float.
f
is equivalent to e.
g
is equivalent to e.
i
matches an optionally signed integer number that is a valid integer constant (in
octal, decimal, or hexadecimal notation). The corresponding obj_ptr must be a
pointer to int.
n
does not match any input or cause any input to be scanned. The corresponding
obj_ptr must be a pointer to int. fscanf stores the number of characters read
from the input thus far into the variable of type int specified by this pointer.
The %n conversion specifier does not increment the count of matches returned
by fscanf.
o
matches an optionally signed octal integer. The corresponding obj_ptr must be
a pointer to int.
p
matches an unsigned hexadecimal integer that uses the lowercase letters a
through f to represent the digits 10 through 15. The corresponding obj_ptr
must be a pointer to pointer to void. Consequently, the integer is interpreted as
a pointer to void.
s
matches a sequence of width characters (1 if width is omitted). The
corresponding obj_ptr must be a pointer to char that points to the first
character of an array large enough to accommodate width + 1 elements. fscanf
appends a null character to the input data.
u
matches an unsigned decimal integer. The corresponding obj_ptr must be a
pointer to int.
x
matches an optionally signed hexadecimal integer that uses the letters A
through F (in uppercase or lowercase) to represent the digits 10 through 15.
The integer may be preceded by 0x or 0X. The corresponding obj_ptr must be
a pointer to int.