My application needs to convert double values to char* to write to a pipe that accepts only characters. The usual ways of doing this are using the sprintf() function or using ostringstream from iomanip.h header file.
Turns out, both of these have really bad performance. And my application needs to do this conversion so often that it becomes the primary bottleneck.
Is there any other function I could use? What logic can I use to write an efficient conversion function? The only thing I have managed to come up with so far is to get each individual digit out using division and mod operations, and append these digits to a char* to get the entire double value. This doesn't seem like a good approach though, and will likely have bad performance itself.
Thanks in advance for your thoughts.
EDIT: There is some confusion over how the char* will be used. The char* will be an argument to the fwrite function which writes to a pipe.