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.)


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

George Greer  -   | Genius may have its limitations, but stupidity | is not thus handicapped. -- Elbert Hubbard

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

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