What is the most optimal way to achieve the same as this?

void foo(double floatValue, char* stringResult)
{
    sprintf(stringResult, "%f", floatValue);
}
c++ c
Edit
Report