|
From: Gregor P. <Gre...@dl...> - 2000-12-07 15:00:38
|
You're right!
I tried it before in a direkt manner which doesn't work :-(
string myString;
char myApples[20];
int myInt;
itoa( myInt, myApples, 10);
myString = "John has " + myApples + " apples";
I get following error message:
invalid operands `const char[28]' and `char[20]' to binary `operator +'
How do I enshure to use the string-version of '+' instead of the integer?
Gregor
> string my1String("John has");
> string my2String("apples!");
> char myApples[20] ;
> int myInt = 6;
>
> itoa(myInt, myApples, 10);
>
> my1String = my1String + myApples + my2String ;
>
> That is you can put all of the strings into one, my1String.
|