On Mon, 16 Aug 1999, Chuck Carson wrote: >When you are adding to a buffer before sending it to the >character, which is the more suitable method? #1 or #3 >1) > >sprintf (buf + strlen(buf), "blah....."); > >or 2) > >sprintf(buf, "%sblah......", buf); This won't work on Borland C as it clears the target buffer before copying. 3) int i = 0; i += sprintf(buf + i, "blah..."); Because further sprintf() calls do not have to recalculate string length, you get it for free. -- George Greer | Sammy's Code - OBuild greerga@circlemud.org | http://www.ticnet.com/samedi/code.html +------------------------------------------------------------+ | 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