I know how to do it with cout:
cout << "string" << 'c' << 33;
But how to perform this so output is redirected to variable instead directly to standard out ?
const char* string << "string" << 'c' << 33; //doesn't work
Use std::stringstream from C++ standard library.
It works like the following:
std::stringstream ss;
ss << "string" << 'c' << 33;
std::string str = ss.str();
const char* str_ansi_c = str.c_str();
Keep in mind str still needs to be in the scope while you are using C-style str_ansi_c.
const char* str_ansi_c = str.c_str();?