Re: Writing over the end of a string

From: Mark A. Heilpern (
Date: 09/09/99

At 03:47 PM 9/9/99 -0400, you wrote:
>That looks fine. Also you will more then likely see this sort of thing
>done in the Circle code with
>   sprintf(buf,"some text");
>   sprintf(buf, "%smore text",buf);

This works under the GNU compiler on my system, but it's a very
poor practice to sprintf into a buffer (buf) with itself like this. What
will happen is compiler dependent, and it could trash your buffer.
It just happens that the GNU compiler is forst putting the result
elsewhere, and then copying it back to the buffer, for safety, but
not all compilers will cover your rear like this.

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

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