I have found that SGI Irix 6.2 and Redhat Linux both do not like the sprintf(buf,"%sblah",buf); syntax, but they are not consistant. (sometimes it works) --Angus George Greer wrote: > > 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. +------------------------------------------------------------+ | 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