
34
output), no argument is expected and the
format_string
is written out
to display screen. For the complete format specification accepted by
the
_printf
function, please refer to the same function in Turbo C++.
Returns
:
The
_printf
function returns the number of characters it has printed.
In case of error, it returns EOF
_printfA
Purpose
:
Use
_printfA
to write character strings and values of C variables,
formatted in a specified manner to specified device.
Syntax
:
int _printfA(int device, char *format_string, …);
Example call
:
_printfA(2, “The product of %d and %d is %d\n”, x, y, x*y);
Include
:
#include
“
UserLib.h
"
Description
:
The
_printfA
function accepts a variable number of arguments and
prints them out to the specified device (as following table). The value
of each argument is formatted according to the codes embedded in
the format specification
format_string.
If the
format_string
does not
contain a % character (except for the pair %%, which appears as a
single % in the output), no argument is expected and the
format_string
is written out to display screen. For the complete
format specification accepted by the
_printfA
function, please refer to the same function
printf
in Turbo C++.
Device No.
Device name
0
Serial port Uart 0
1
Serial port Uart 1
2 Display
screen
3 Buffer
pointer
format_string
(write back)
Returns
:
The
_printfA
function returns the number of characters it has printed.
In case of error, it returns EOF.
_scanf
Purpose
:
Use
_scanf
to read character strings from keyboard (standard input
device) and convertthe strings to values of C variables accordin to
specified formats. As example, you can use
_scanf
to read a value
into a short integer from keyboard.
Syntax
:
int _scanf(const char *format_string, …);
Example call
:
_scanf(“ %d:%d:%d”, &hour, &minute, &second);
Includes
:
#include
“
UserLib.h
"
Description
:
The
_scanf
function accepts a variable number of arguments, which it
Содержание PT-10
Страница 4: ...3 Keyboard Wedge 99 System 101 Power 102 Other 102 ...
Страница 13: ...12 6 Development Flow Chart ...
Страница 53: ...52 Returns No returns Notes ...