HP C/iX Library Reference Manual (30026-90004)
386 Chapter5
HP C/iX Library Function Descriptions
vfprintf
vfprintf
Writes data in formatted form to an open stream using a variable argument list.
Syntax
#include <stdarg.h>
#include <stdio.h>
int vfprintf (FILE *
stream
, const char *
format
,
va_list
arg
);
Parameters
stream
A pointer to an open stream where data is to be written.
format
A pointer to a character string defining the format (or the character string
itself enclosed in double quotes).
arg
A variable argument list initialized by va_start (defined in the header
<stdarg.h>).
Return Values
≥0 The number of characters written.
<0 An error occurred.
Description
The vfprintf function enables you to output data in formatted form to an open stream. In
the vfprintf function,
string
points to an open stream, and
format
points to a character
string (or the character string itself enclosed in double quotes) that specifies the format
and content of the data to be written. The
arg
parameter is a variable argument list
containing variables or expressions specifying the data to be written.
arg
must be
initialized by the va_start macro prior to a call to vfprintf().
The
arg
parameter specifies conversion specifications and literal characters. Literal
characters are all characters that are not part of a conversion specification. Literal
characters are written to the open stream exactly as they appear in the format.
Conversion Specifications
The following list shows the different components of a conversion specification in their
correct sequence:
1. A percent sign (%), which signals the beginning of a conversion specification; to output
a literal percent sign, you must type two percent signs (%%).
2. Zero or more flags, which affect the way a value is written (see below).
3. An optional decimal digit string which specifies a minimum field width.