Synopsis, Returns, Examples – Zilog ZUSBOPTS User Manual
Page 466: Scanf conversion characters

Standard Functions
UM017105-0511
438
Zilog Developer Studio II – ZNEO™
User Manual
See the next section, scanf Conversion Characters, for valid input information.
Synopsis
#include
int scanf(const char *format, ...);
Returns
The value of the macro EOF if an input failure occurs before any conversion. Otherwise,
the
scanf
function returns the number of input items assigned, which can be fewer than
provided for, or even zero, in the event of an early conflict between an input character and
the format.
Examples
int i
scanf("%d", &i);
The following example reads in two values.
var1
is an
unsigned
char
with two decimal
digits, and
var2
is a
float
with three decimal place precision.
scanf("%2d,%f",&var1,&var2);
scanf Conversion Characters
d
Matches an optionally signed decimal integer, whose format is the same as
expected for the subject sequence of the strtol function with the value 10 for the
base argument. The corresponding argument is a pointer to integer.
i
Matches an optionally signed integer, whose format is the same as expected for
the subject sequence of the strtol function with the value 0 for the base argu-
ment. The corresponding argument is a pointer to integer.
o
Matches an optionally signed octal integer, whose format is the same as
expected for the subject sequence of the strtol function with the value 8 for the
base argument. The corresponding argument is a pointer to integer.
u
Matches an unsigned decimal integer, whose format is the same as expected for
the subject sequence of the strtol function with the value 10 for the base argu-
ment. The corresponding argument is a pointer to unsigned integer.
x
Matches an optionally signed hexadecimal integer, whose format is the same as
expected for the subject sequence of the strtol function with the value of 16 for
the base argument. The corresponding argument is a pointer to integer.
e,f,g
Matches an optionally signed floating-point number, whose format is the same as
expected for the subject string of the strtod function. The corresponding argu-
ment is a pointer to floating.
Note: