Next: viscanf, Previous: vfwscanf, Up: Stdio

### 4.74 `viprintf`, `vfiprintf`, `vsiprintf`, `vsniprintf`, `vasiprintf`, `vasniprintf`—format argument list (integer only)

Synopsis

         #include <stdio.h>
         #include <stdarg.h>
         int viprintf(const char *fmt, va_list list);
         int vfiprintf(FILE *fp, const char *fmt, va_list list);
         int vsiprintf(char *str, const char *fmt, va_list list);
         int vsniprintf(char *str, size_t size, const char *fmt,
             va_list list);
         int vasiprintf(char **strp, const char *fmt, va_list list);
         char *vasniprintf(char *str, size_t *size, const char *fmt,
             va_list list);

         int _viprintf_r(struct _reent *reent, const char *fmt,
             va_list list);
         int _vfiprintf_r(struct _reent *reent, FILE *fp,
             const char *fmt, va_list list);
         int _vsiprintf_r(struct _reent *reent, char *str,
             const char *fmt, va_list list);
         int _vsniprintf_r(struct _reent *reent, char *str,
             size_t size, const char *fmt, va_list list);
         int _vasiprintf_r(struct _reent *reent, char **str,
             const char *fmt, va_list list);
         char *_vasniprintf_r(struct _reent *reent, char *str,
             size_t *size, const char *fmt, va_list list);

Description
`viprintf`, `vfiprintf`, `vasiprintf`, `vsiprintf`, `vsniprintf`, and `vasniprintf` are (respectively) variants of `iprintf`, `fiprintf`, `asiprintf`, `siprintf`, `sniprintf`, and `asniprintf`. They differ only in allowing their caller to pass the variable argument list as a `va_list` object (initialized by `va_start`) rather than directly accepting a variable number of arguments. The caller is responsible for calling `va_end`.

`_viprintf_r`, `_vfiprintf_r`, `_vasiprintf_r`, `_vsiprintf_r`, `_vsniprintf_r`, and `_vasniprintf_r` are reentrant versions of the above.

Returns
The return values are consistent with the corresponding functions:

Portability
All of these functions are newlib extensions.

Supporting OS subroutines required: `close`, `fstat`, `isatty`, `lseek`, `read`, `sbrk`, `write`.