Writes formatted output to a string dynamically allocated with malloc and stores the address of the string.
#include <stdarg.h> #include <stdio.h> int vasprintf ( char **string, const char *format, va_list arg );
(OUT) Points to the address of the null-terminated string. You are responsible for freeing the memory allocated for this string.
(IN) Points to the format control string. See Print Format Control Strings.
(IN) Specifies a variable argument list. The number of arguments is determined by the format string.
If successful, returns the number of characters written. Otherwise, returns -1 and sets errno.
The vfprintf function writes output to the file pointed to by fp under control of the format parameter. The vfprintf function is equivalent to fprintf, with the variable arguments replaced with arg, which has been initialized by the va_start macro.