Next: viscanf, Previous: tmpnam, Up: Stdio

### 4.53 `viprintf`, `vfiprintf`, `vsiprintf`—format argument list

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 vasiprintf(char **strp, const char *fmt, va_list list);
         int vsniprintf(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 _vasiprintf_r(struct _reent *reent, char **str,
             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);

Description
`viprintf`, `vfiprintf`, `vasiprintf`, `vsiprintf` and `vsniprintf` are (respectively) variants of `iprintf`, `fiprintf`, `asiprintf`, `siprintf`, and `sniprintf`. They differ only in restricting the caller to use non-floating-point format specifiers.

Returns
The return values are consistent with the corresponding functions: `vasiprintf`/`vsiprintf` returns the number of bytes in the output string, save that the concluding `NULL` is not counted. `viprintf` and `vfiprintf` return the number of characters transmitted. If an error occurs, `viprintf` and `vfiprintf` return `EOF` and `vasiprintf` returns -1. No error returns occur for `vsiprintf`.

Portability
`viprintf`, `vfiprintf`, `vasiprintf`, `vsiprintf` and `vsniprintf` are newlib extensions.

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