delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/11/19:26:33

To: djgpp AT delorie DOT com
Date: Tue, 11 Jan 2000 19:10:20 -0500
Subject: Re: strcat() bug?
Message-ID: <20000111.192324.-409293.2.roberts.j.whitlock@juno.com>
X-Mailer: Juno 4.0.5
MIME-Version: 1.0
X-Juno-Att: 0
X-Juno-RefParts: 0
From: Robert S Whitlock <roberts DOT j DOT whitlock AT juno DOT com>
Reply-To: djgpp AT delorie DOT com

Aha! I get it now. Thanks alot guys :)

> When you use the strcat function, it is your responsibility to make 
> sure
> that the destination buffer is big enough to hold the combined 
> string. 
> Therefore 'strcat(msg, " typed a line\n")' where msg is initialized 
> as
> "Processing with GUI" will mess up other variables (first on the 
> line is
> the variable that's declared after the string.
> 
> The idiom
>   char buf[1024];
>   strcat(buf, "Some text");
>   strcat(buf, "Some more text.");
> is usually used to build up a short dynamic string.
> 
> --
> Weiqi Gao
> weiqigao AT a DOT crl DOT com



--Robert Whitlock
http://www.geocities.com/CapeCanaveral/Hangar/9520/
ICQ 60123256

- Raw text -


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