Straight into business: I have code looking roughly like this:
char* assemble(int param)
{
char* result = "Foo" << doSomething(param) << "bar";
return result;
}
Now what I get is:
error: invalid operands of types ‘const char [4]’ and ‘char*’ to binary ‘operator<<’
Edit:
doSomething returns a char*.
So, how do I concatenate these two?
Additional info:
Compiler: g++ 4.4.5 on GNU/Linux 2.6.32-5-amd64
"Foo"and"Bar"are literals, they don’t have the insertion (<<) operator.you instead need to use
std::stringif you want to do basic concatenation: