Re: Newbie Coding: two bufs in sprintf

From: George (greerga@DRAGON.HAM.MUOHIO.EDU)
Date: 09/30/97


On Sat, 27 Sep 1997, Chris Jacobson wrote:

>Notice it is: "%stext %s", buf
>So that "text %s" will be concatenated onto the end of what buf currently
>contains, and the final string will be written back into buf.  Sprintf is
>safe to do such overwriting of buffers becuase it uses secondary buffers
>for safety reasons.

Actually, it doesn't always from my experience. (The (2*) patch.)

Try:

sprintf(buf, "Text: %s", buf);

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST