Writes formatted output to a specified file designated by stdout.
#include <stdio.h> int printf ( const char *format, ... );
(IN) Points to the format control string. See Print Format Control Strings.
(IN) Points to an argument for a conversion specifier. The number of arguments is determined by the format string.
If successful, returns the number of characters written. Otherwise, returns a negative value and sets errno to one of the following:
The printf function writes output to the file designated by stdout under control of the format parameter.
For example, a specifier of the form %8.*f defines a field to be at least 8 characters wide and gets the next argument for the precision to be used in the conversion.
The output from
printf ("f1 = %8.4f f2 = %10.2E x = %#08x i = %d", 23.45, 3141.5926, 0x1db, -1 );
would be
f1 = 23.4500 f2 = 3.14E+003 x = 0x0001db i = -1
You can also use strings similar to the following:
printf ("Test: %3$s %2$d %1$s", string, 10, string);