Re: Which is the best way...

From: Zeavon (zeavon@kilnar.com)
Date: 08/16/99


> When you are adding to a buffer before sending it to the
> character, which is the more suitable method?
>
> 1)
> sprintf (buf + strlen(buf), "blah.....");
>
> or 2)
> sprintf(buf, "%sblah......", buf);

The first method is accepted by all compilers. The second method gets choked
on by some (namely Borland).

I think that the first method is "more correct" than the second (in the eye
of a purist), but you should use what you feel most comfortable with. If
it's easier for you to read the first, use it. If the second is easier, use
it instead. If you use what is comfortable (most of the time) you reduce the
chances of human-error in the code.


--
Zeavon Calatin, Spear of Insanity
spear.kilnar.com:1066
http://spear.kilnar.com/


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



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