Table of Contents
Previous Section Next Section

vprintf, vfprintf, vsprintf, and vsnprintf

#include <stdarg.h>
#include <stdio.h>
int vprintf(char *format, va_list arg_ptr);
int vfprintf(FILE *stream, const char *format,
             va_list arg_ptr);
int vsprintf(char *buf, const char *format,
             va_list arg_ptr);
int vsnprintf(char * restrict buf, size_t num,
              const char * restrict format,  va_list arg_ptr);

The functions vprintf( ), vfprintf( ), vsprintf( ), and vsnprint( ) are functionally equivalent to printf( ), fprintf( ), sprintf( ), and snprintf( ), respectively, except that the argument list has been replaced by a pointer to a list of arguments. This pointer must be of type va_list, which is defined in the header <stdarg.h>.

In C99, buf and format are qualified by restrict. The vsnprintf( ) function was added by C99.

Related functions are vscanf( ), vfscanf( ), vsscanf( ), va_arg( ), va_start( ), and va_end( ).


Table of Contents
Previous Section Next Section