One way would be to use a string stream (include <sstream>), output data of various types into it, and then grab the output as a string or as a const char*, like this:
std::stringstream ss;
int a = 1;
std::string b = "str";
ss << a << b;
std::string res(ss.str());
const char *x = res.c_str();
Demo on ideone.
If you need to convert to char*, not to const char*, make a copy of c_str instead - replace the last line as follows:
char *x = new char[res.size()+1];
strcpy(x, res.c_str());
// Use x here, then...
delete[] x;
Finally, you can use vector instead of a string to get a writable pointer without the need to delete. Note that this approach does not let you return your char* from a function, because its data would be tied to the scope of the vector with its characters. Here is a demo of this approach.