Guardian C Library Calls Reference Manual

Reference to Library Calls
Guardian TNS C Library Calls Reference Manual128833 3-141
printf
printf
The printf function writes formatted data to the standard output file.
format
points to a string that contains characters and conversion specifiers. Refer to
“fprintf” on page 3-51 for a description of format and conversion specifiers.
expr...
is the list of arguments to be formatted using the conversion specifiers in *format.
Return Value
is the number of characters output if the operation is successful; otherwise, printf
returns a negative value.
Usage Guidelines
To print a percent sign, you must precede it with a percent sign; for example:
printf("Stock went up %d%%\n", increase);
When the converted printf argument has fewer characters than the specified field
width, printf uses blanks to pad out the extra space. To request padding with zeroes
instead of blanks, precede the field width with a zero; for example:
printf("%3d%3s\n", 5, "A");
printf("%03d%03s\n", 5, "A");
produces the following:
5 A
00500A
#include <stdioh>
int printf(const char *format, [expr...]);