> sprintf(buf, mob->long_desc (which contains a newline code) > > Then do this, > > sprintf(buf + (strlen(buf) - 1), " more text\n"); > > Effectively writing over the first new line, adding more > text and then adding a new 'newline'. 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); To do the same thing but overwrite the last newline sprintf(buf, mob->long_desc (which contains a newline code) buf[strlen(buf)-1] = '\0'; sprintf(buf,"%smore text", buf); buf = "hello\n", strlen(buf) = 6 setting buf[5] = '\0' yields buf = "hello" -------------------------------------------------------------------------- Ron Hensley (ronh@intercom.net) Network Administrator - ICNet Internet Services -------------------------------------------------------------------------- +------------------------------------------------------------+ | 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