Is it safe to use sprintf with the destination string used amongst source parameters?
For example, I want to create a function that returns a list as a CSV string.
void csvize(char length, char* data)
{
output[1000];
sprintf(output,"%d",data[0])
for(int i=1; i<char length, i++)
{
sprintf(output,"%s,%d",output,data[i]); // note "output" used twice!
}
do_something_with(output);
}
Tags: