HP C/iX Library Reference Manual (30026-90004)
390 Chapter5
HP C/iX Library Function Descriptions
vprintf
vprintf
Writes data in formatted form to the standard output stream stdout using a variable
argument list.
Syntax
#include <stdarg.h>
#include <stdio.h>
int vprintf (const char *
format
, va_list
arg
);
Parameters
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 vprintf function enables you to output data in formatted form to stdout. In the
vprintf function,
string
is a pointer to stdout, and
format
is a pointer 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. The
arg
parameter
must be initialized by the va_start macro prior to a call to vprintf().
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 stdout 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 (%), that signals the beginning of a conversion specification; to output a
literal percent sign, you must type two percent signs (%%).
2. Zero or more flags, that affect the way a value is printed (see below).
3. An optional decimal digit string that specifies a minimum field width.
4. An optional
precision
, consisting of a dot (.) followed by a decimal digit string.