View Full Version : C++ strings

07-10-2007, 10:53 PM
This sounds like such a stupid question, I can do this is PHP and VB6, but my teacher never told us how to in C++. Lets say I have a string, that will always be the same and this it is hard coded into the program with quotes around it, and then I have something that will change and I need to append that onto the end to place it in a function call. Can anyone tell me how to do this? I have included the equivelent in PHP below

theFunction("This is part one " . $appendthis);

07-10-2007, 11:55 PM
It depends what parameter theFunction takes. Is it using the string class or a char*?

If it is the former:

string appendthis;

//Your code

theFunction("This is part one" + appendthis);