Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

vprintf - Formatted output to the standard output

&pagelevel(4)&pagelevel

Definition

#include <stdio.h>

int vprintf(const char *format, va_list arg);

vprintf is similar to the printf function except that, unlike printf, vprintf permits the
output of arguments whose number and data types are not known at compilation time.
vprintf is used within functions to which the caller can pass a different format string and
different arguments for output each time. The formal parameter list of the function definition
provides for a format string format and a variable argument list ", ..." for this purpose.
format is a format string as described under printf with ANSI functionality (see printf).

vprintf successively steps through an argument list arg using internal va_arg calls and
writes the arguments according to format string format on the standard output stdout. The
variable argument list arg must be initialized with the va_start macro before vprintf is
called.

Return val.

Number of characters output

if successful.

Integer< 0

if an error occurs.

Notes

vprintf always starts with the first argument in the variable argument list. It is possible to
start output from any particular argument by issuing the appropriate number of va_arg calls
before calling the vprintf function. Each va_arg call advances the position in the
argument list by one argument.

vprintf does not call the va_end macro. Since vprintf uses the va_arg macro, the
value of arg is undefined on return.

The following applies in the case of text files with SAM access mode and variable record
length for which a maximum record length is also specified: When the specification
split=no was entered for fopen, records which are longer than the maximum record
length are truncated to the maximum record length when they are written. By default or with
the specification split=yes, these records are split into multiple records. If a record has
precisely the maximum record length, a record of the length zero is written after it.

Example

See also

See under vfprintf

vfprintf, vsprintf, vsnprintf