|
From: Chad S. <ho...@ho...> - 2000-12-07 16:32:22
|
Or you can do it with parentheses.. string myString; ((myString += "John has ") += myApples ) += " apples"; But this sort of thing should really be done with a strstream. Perhaps if Gregor could show more specifically what his code looks like I could explain how he's using the strstream wrong. Chad Simmons >From: James Gordon <Jam...@Cl...> >Reply-To: dev...@li... >To: "'dev...@li...'" ><dev...@li...> >Subject: RE: [Dev-C++] string-version of '+' >Date: Thu, 7 Dec 2000 15:34:59 -0000 > >this might not be the best way but I've always had to split the code into >two statements. > >Change this: >myString = "John has " + myApples + " apples"; > >To this: >myString = "John has " + myApples; >myString += " apples"; > [Snip] > >James. > > >-----Original Message----- >From: Gregor Peter [mailto:Gre...@dl...] >Sent: Thursday, December 07, 2000 2:58 PM >To: exc...@sp...; dev...@li... >Subject: [Dev-C++] string-version of '+' > > >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 >+' _____________________________________________________________________________________ Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com |