From: "Campbell, Rolf [SKY:1U32:EXCH]" Newsgroups: comp.os.msdos.djgpp Subject: Re: Catenation (spelled right?) of strings Date: Tue, 17 Aug 1999 11:39:49 -0400 Organization: Nortel Networks Lines: 29 Message-ID: <37B98244.226F207F@americasm01.nt.com> References: <37B36D0D DOT 7F00 AT lords DOT com> <37B8E3D3 DOT 516 AT my-deja DOT com> NNTP-Posting-Host: bmerhc00.ca.nortel.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.7 [en] (X11; I; HP-UX B.10.20 9000/712) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com John Clonts wrote: > > char THE_STRING [255]; > > THE_STRING = "GOATS " + "MAKE " + "GOOD " + "PETS!"; > > My compiler (DGJPP gccw32.exe) says: "invalid operands to binary +" > > #include > int main() > { > string theString = "GOATS " + "MAKE " + "GOOD " + "PETS!"; > } Even though I've never used 'string' as a C++ datatype, and I did not test your program, I really don't think this'll work. You're trying to apply the '+' operator to 'char*'s. In C++, you can't over-ride that operator. I don't think you can override any pointer operators. You could do: string theString = "GOATS "; theString = theString + "MAKE " + "GOOD " + "PETS!"; -- -Rolf Campbell (39)3-6318