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 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Juno-Att: 0 X-Juno-RefParts: 0 From: Robert S Whitlock 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