www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/13/09:20:50

Message-ID: <37B40698.B068C66F@hem2.passagen.se>
From: Stefan Ekman <stekman AT hem2 DOT passagen DOT se>
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.5-15 i686)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Catenation (spelled right?) of strings
References: <37B36D0D DOT 7F00 AT lords DOT com>
Lines: 20
Date: Fri, 13 Aug 1999 11:50:50 GMT
NNTP-Posting-Host: 62.20.139.70
X-Complaints-To: abuse AT telia DOT com
X-Trace: newsb.telia.net 934545050 62.20.139.70 (Fri, 13 Aug 1999 13:50:50 CEST)
NNTP-Posting-Date: Fri, 13 Aug 1999 13:50:50 CEST
Organization: Telia Internet
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Robinson S." wrote:

> Is it possible to group a bunch of strings into an array of char:
>
> I tried this:
> char THE_STRING [255];
> THE_STRING = "GOATS " + "MAKE " + "GOOD " + "PETS!";
>
> My compiler (DGJPP gccw32.exe) says: "invalid operands to binary +"

The operator + can't be used with char-lists. If you program C++ you can
use strings instead:

#include <string>

string THE_STRING;
THE_STRING = "GOATS " + "MAKE " + "GOOD " + "PETS!";

/Stefan

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019