|
||
int fprintf( FILE *fp, char *fmt, ... )
FILE *fp; /* output stream pointer */ char *fmt; /* format string */
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Synopsis |
#include "stdio.h"
The fprintf function writes text to the file associated with fp according to format string fmt . Arguments following fmt are formatted and printed in the output string.
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Parameters |
fp is a stream pointer, open for output. fmt is a null-terminated string, containing format conversion specifications. In the processing of fmt , when fprintf encounters a conversion specification, it retrieves an argument and formats it into the output string at that location, replacing the conversion specifier. All other characters are copied into the output string. Conversion specifiers are introduced in the format string by the percent character '%' . More specifically, conversion specifiers take the following form:
%[flags][minimum field width][precision][size specification][conversion]
where:
Flags:
Conversion specifiers:
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Return Value |
fprintf returns the number of characters printed.
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comments |
The types of arguments must match those expected by the format specifiers in fmt, and the number of arguments must be greater than or equal to the number of specifiers in fmt; otherwise, the result of fprintf is undefined.
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
See Also |
printf , sprintf , ss_command |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|