C++: what is the optimal way to convert a double to a string?

后端 未结 12 1763
温柔的废话
温柔的废话 2020-12-16 17:09

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

void foo(double floatValue, char* stringResult)
{
    sprintf(stringResult, \"%f\", floatV         


        
12条回答
  •  自闭症患者
    2020-12-16 17:46

    I'd probably go with what you suggested in your question, since there's no built-in ftoa() function and sprintf gives you control over the format. A google search for "ftoa asm" yields some possibly useful results, but I'm not sure you want to go that far.

提交回复
热议问题