www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/13/11:35:14

From: "Campbell, Rolf [SKY:1U32:EXCH]" <cp1v45 AT americasm01 DOT nt DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Catenation (spelled right?) of strings
Date: Fri, 13 Aug 1999 10:51:14 -0400
Organization: Nortel Networks
Lines: 20
Message-ID: <37B430E2.779B65E0@americasm01.nt.com>
References: <37B36D0D DOT 7F00 AT lords DOT com> <37B37463 DOT 4CB8 AT lan DOT tjhsst DOT edu>
NNTP-Posting-Host: bmerhc00.ca.nortel.com
Mime-Version: 1.0
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

Moogla wrote:

> Robinson S. wrote:
> > How do I join those strings?
>
> 1) use the C library function strcat(char *, char *)
>
> char * THE_STRING = strcat("GOATS", "MAKE);

    That isn't going to work.  The "GOATS" string is a constant and cannot
be modified, but strcat will try to modify it, also, there is only 6 bytes
allocated to the "GOATS" string, and you will try to shove 10 in there with
strcat, which will overwrite other memory.


--
     -Rolf Campbell (39)3-6318



- Raw text -


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