##### Synopsis

    #include <stdio.h>
    int vsprintf(char *s, const char *format, va_list arg);

##### Description

vsprintf writes to the string pointed to by s under control of the string pointed to by format that specifies how subsequent arguments are converted for output. Before calling vsprintf, arg must be initialized by the va_start macro (and possibly subsequent va_arg calls). vsprintf does not invoke the va_end macro.

A null character is written at the end of the characters written; it is not counted as part of the returned value.

If there are insufficient arguments for the format, the behavior is undefined. If the format is exhausted while arguments remain, the excess arguments are evaluated but are otherwise ignored.

If copying takes place between objects that overlap, the behavior is undefined.

vsprintf returns number of characters transmitted (not counting the terminating null), or a negative value if an output or encoding error occurred.

##### Notes

vsprintf is equivalent to sprintf with the variable argument list replaced by arg,

##### Portability

vsprintf conforms to ISO/IEC 9899:1990 (C90) and ISO/IEC 9899:1999 (C99).

##### See Also

Format strings for printf functions