30
CHAPTER 4 Program Reference for the Standard I/O Library
4.3
Standard I/O Function Interface Printf
Outputs a character string to the standard output device in accordance with the
specified format.
■
Printf
[
Interface
]
Format
int chrcnt = printf(B *format [,data1 [,data2 ...]]);
Parameters
format
:Pointer to the output format string
data1, ...
:Output data
Return parameter chrcnt
:Number of characters output
[
Description
]
Outputs a character string to the standard output device in accordance with the specified format.
The control specifiers in the output format string specify the type and output format of the
parameters following the format parameter. Characters other than control specifiers in the format
are output directly to the standard I/O device. Control specifiers start with the percent (%)
character and specify the format as follows.
%[control][field][l]type
❍
control:... A control character that specifies the output format. The following can be
specified.
❍
field ........ A numeric value that specifies the number of characters to output in the
output data. The output data is not truncated if it requires more than the
specified number of characters. If the number starts with a zero (0), the
leading spaces of the output data are filled with zeros.
If the number of output characters is omitted, the output data is output in the
required number of characters.
❍
l.............. Indicates that the type of the corresponding data is long (4-byte data). Such
data must be pushed onto the stack as four bytes (for a C program, the data
type must be long). If omitted, the stack data is treated as 2-byte data.
❍
type........ A control character that specifies the type of the output data. The following
types are available.
Control
Character
Format
Processing When Omitted
-
+
#
Left justify
Output the sign
Output the radix
Add leading spaces
Right justify
No sign
No radix
No leading spaces
]
*
Summary of Contents for F2MC-16L Series
Page 2: ... ...
Page 4: ... ...
Page 10: ...vi ...
Page 12: ...viii ...
Page 44: ...32 CHAPTER 4 Program Reference for the Standard I O Library ...
Page 53: ...41 APPENDIX B Running the Sample System Figure Be Project Member List ...
Page 54: ...42 APPENDIX Figure Bf Set Configuration File Dialog Box ...
Page 64: ...52 APPENDIX Figure Cb Sample System Memory Map Continued ...
Page 65: ...53 INDEX INDEX The index follows on the next page This is listed in alphabetic order ...
Page 68: ... ...