vsprintf() is the same as the sprintf() function. In contrast to sprintf() ,
vsprintf() allows for the output of arguments whose number and data type are not known at the time of compilation.
vsprintf() is used in functions that can be passed a different format string as well as different arguments for output from the caller. The format string format stands for the formal parameter list of the function definition and a variable argument list ", ...".
vsprintf() processes an argument list arg with successive internal va_arg calls and writes the arguments to the string s according to the format string format. The variable argument list arg must be initialized before calling vsprintf() using the va_start macro. The function has the following parameters:
char *s Pointer to the resulting string. vsprintf() terminates the string with the null byte (\0). const char *format Format string like for printf() with ANSI functionality (see printf() for a description). The following difference exists with respect to white space characters (\n, \t, etc.):
vsprintf() enters the EBCDIC value of the control character in the resulting string. Only when it is output to a text file will the control characters be converted to their appropriate effect in accordance with the type of text file (see "White-space characters"). va_list arg Pointer to the variable argument list that was initialized with va_start . |