I’m trying to pass a “char**” to another function (the function I want to use requires that form as the parameter), but what I have is an array of doubles.
I keep trying to find some way to convert the doubles to C-strings and either collect or concatenate them, but… I’m rolling around and not getting anywhere except compiler errors.
I’d post the code, but it’s all not working junk for this.
Anyone happen to know how to take 7 double values and get a char** with them?
If you’re using C, one option is to allocate
charbuffers and callsnprintf()to build string values from doubles, much like you would if printing a string to the console (e.g. a format string such as"%f"followed by the value).If you can use C++, the
std::ostringstreamclass has a similar effect (<sstream>header); you can<<numerical values into it, callstr()to create astd::string, and finally callc_str()on thestringobject to get achar*. These pointers could be put into a temporary C array to produce achar**.