COHERENT manpages

This page displays the COHERENT manpage for vprintf() [Print formatted text into standard output stream].

List of available manpages
Index


vprintf() -- STDIO Function (libc)

Print formatted text into standard output stream
#include <stdarg.h>
#include <stdio.h>
int
vprintf(format, arguments)
char *format; va_list arguments;

vprintf() constructs  a formatted  string and  writes it into  the standard
output stream.  It translates integers, floating-point numbers, and strings
into a  variety of  text formats.   vprintf can handle  a variable  list of
arguments  of  various  types.   It  is  roughly equivalent  to  printf()'s
conversion specifier %r.

format points  to a string that can contain  text, character constants, and
one or more  conversion specifications.  A conversion specification defines
how  a particular  data type  is converted into  a particular  text format.
Each conversion specification is introduced with the percent sign `%'.  (To
print a  literal percent sign, use the escape  sequence `%%'.) See printf()
for further  discussion of the conversion specification and  for a table of
the type specifiers that can be used with vprintf().

After format comes arguments. This is  of type va_list, which is defined in
the header  stdarg.h. It has  been initialized by the  macro va_start() and
points  to the  base  of the  list  of arguments  used  by vprintf().  Each
argument must have basic type that  can be converted to a pointer simply by
adding  an `*'  after the  type name.   This is  the same  restriction that
applies to  the arguments to the macro va_arg().  For more information, see
va_arg().

arguments should  access one argument for  each conversion specification in
format of  the type appropriate to  conversion specification.  For example,
if  format contains  conversion specifications  for an int,  a long,  and a
string, then arguments access three arguments, being, respectively, an int,
a long, and a char *.

If there are fewer arguments than conversion specifications, then vprintf's
behavior is  undefined (and probably  unwelcome).  If there  are more, then
vprintf() evaluates and then ignores every argument without a corresponding
conversion specification.   If an argument is  not of the same  type as its
corresponding  type  specification,  then  the  behavior  of  vprintf()  is
undefined;  thus, accessing  an int  where vprintf() expects  a char  * may
generate unwelcome results.

If it  writes the formatted string correctly,  vprintf() returns the number
of characters written; otherwise, it returns a negative number.

See Also

fprintf(),
libc,
printf(),
sprintf(),
vfprintf(),
vsprintf()
ANSI Standard, §7.9.6.8

Notes

vprintf() can construct a string up to at least 509 characters long.