asprintf

Name

asprintf -- write formatted output to a string dynamically allocated with malloc and store the address of the string

Synopsis

#include <stdio.h>

extern int asprintf(char **restrict ptr, const char *restrict format ...);

Description

asprintf has the same behavior as sprintf, but calls malloc to dynamically allocate space for the output, and then puts the output string in that space.

asprintf stores the address of the string in ptr.