vsnprintf() — Format and print data to fixed length buffer
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
C99 |
both | z/OS® V1R6 |
Format
#define _ISOC99_SOURCE
#include <stdio.h>
#include <stdarg.h>
int vsnprintf(char *__restrict__ s, size_t n,
const char *__restrict__ format, va_list arg);
General description
Equivalent to snprintf(), except that instead of being called with a variable number of arguments, it is called with an argument list as defined by <stdarg.h>.
Returned value
Returns the number of characters that would have been written had n been sufficiently large, not counting the terminating null character, or a negative value if an encoding error occurred. Thus, the null-terminated output has been completely written if and only if the returned value is nonnegative and less than n.