Re: more code

From: Wout Mertens (Wout.Mertens@rug.ac.be)
Date: 07/17/96


[ok, raking up some old leaves...]

On Sat, 13 Jul 1996, Nick B wrote:

> Now, I am a novice programmer, but I don't see what is wrong with this
> little bit of code in my act.informative.c:

[cut]
>    sprintf(buf, "%s                   Info for %s\r\n", buf, GET_NAME(ch));
[cut]
>    sprintf(buf, "You are %d years old.", GET_AGE(ch));
You were already shown the error but I would like to add a little something:
I always use
sprintf(buf + strlen(buf), "     Info for etc", foo, bar);

Normally, this should be faster than just printfing buf to buf...
AND it is clearer...

Gekke Eekhoorn of BUG.



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