J
jasonwthompson
I'm converting some old C code to C++. Although I'm not concerned
about converting every C item to C++ I'm in a situation in which using
an ostringstream makes more sense than using sprintf. Here's my
problem: In sprintf, one could use the %g symbol to indicate that I
either wanted scientific notation or a simple floating point,
whichever is smaller. Is there a way to do that using an
ostringstream?
Basically, what is the ostringstream equivalent of:
sprintf(buffer, "%-20.12g",mynum);
about converting every C item to C++ I'm in a situation in which using
an ostringstream makes more sense than using sprintf. Here's my
problem: In sprintf, one could use the %g symbol to indicate that I
either wanted scientific notation or a simple floating point,
whichever is smaller. Is there a way to do that using an
ostringstream?
Basically, what is the ostringstream equivalent of:
sprintf(buffer, "%-20.12g",mynum);