The following C function:
int sprintf ( char * str, const char * format, ... );
writes formatted data to a string. The size of the array pa
You can use either snprintf or asprintf. snprintf involves checking the size and resizing if necessary, whereas asprintf simply allocates the correct size for you.