I am heavily struggling with a question which should be very easy: how do I do a simple type conversion (from double
into char*
) in basic C.
I have found quite some solutions, but they are all based on conversions from double
to char[x]
, but I am working here with char*
, not with char[]
. (I don't know how long the resulting string will be).
On top of that, I really can't believe that another type (be it stringstream
, std::strings
, ...) are needed for something that simple.
I admit, I'm a complete newbie in basic C, but I have worked in other languages (Visual Basic, Delphi, Java, ...) and I just can't understand why I can't find a simple function like "to_char_pointer(double d)" to do this.
Does anybody have an idea?
`using namespace std;`
`string str = to_string((long double)vector_with_doubles->at(i));`
Hence this question can indeed be closed.