Prints formatted output based on an argument list.
This function is supported on OpenVMS Integrity servers and
Alpha only.
Format
#include <stdio.h>
int vsnprintf (char *str, size_t n, const char *format,
va_list ap);
1 – Arguments
str
A pointer to a string that will receive the formatted output.
format
A pointer to a character string that contains the format
specification.
ap
A list of expressions whose resultant types correspond to the
conversion specifications given in the format specifications.
2 – Description
The vsnprintf function is the same as the snprintf function, but
instead of being called with a variable number of arguments, it
is called with an argument list that has been initialized by va_
start (and possibly with subsequent va_arg calls).
This function does not invoke the va_end macro. Because the
function invokes the va_arg macro, the value of ap after the
return is unspecified.
Applications using vsnprintf should call va_end(ap) afterwards to
clean up.
3 – Return Values
x The number of bytes (excluding the terminating
null byte) that would be written to str if n
is sufficiently large.
Negative value Indicates an output error occurred. The
function sets errno. For a list of possible
errno values set, see fprintf.