![]() Chapter Contents |
![]() Previous |
![]() Next |
| vprintf |
| Portability: | ISO/ANSI C conforming |
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| EXAMPLE | |
| RELATED FUNCTIONS | |
| SEE ALSO |
| SYNOPSIS |
#include <stdarg.h> #include <stdio.h> int vprintf(const char *format, va_list arg);
| DESCRIPTION |
vprintf
is equivalent to
printf
with
arg
replacing the variable-argument list.
arg
has been initialized by the
va_start
macro and possibly
va_arg
calls.
vfprintf
does not invoke the
va_end
macro. See va_arg, va_end, and
va_start for details
on varying-length argument-list functions.
| RETURN VALUE |
vprintf
returns the number of characters transmitted to
stdout
or a negative value if an output error occurs.
| EXAMPLE |
This example sends an error message prefix
to
stdout
with
printf
and sends the remaining text to
stdout
with
vprintf
:
#include <stdarg.h>
#include <stdio.h>
void error(char *fname, char *format, ...)
{
va_list args;
va_start(args, format);
printf("ERROR in %s: ", fname);
vprintf(format, args);
va_end(args);
}
| RELATED FUNCTIONS |
| SEE ALSO |
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.