Re: Score command.

From: Chris Rehbein (lint@jhu.edu)
Date: 02/22/97


At 03:30 PM 2/22/97 -0500, you wrote:

-=-<*snip*>-=-

>  sprintf(buf, "%sCoins: [ %d ], Bank: [ %d ]\r\n", buf,      <-------- buf
>          GET_GOLD(ch), GET_BANK_GOLD(ch));
>  sprintf(buf2, "Lev: [%2d], XP: [%7d], Align: [%4d]\r\n",    <-------- buf2
>          GET_LEVEL(ch), GET_EXP(ch), GET_ALIGNMENT(ch));
>  strcat(buf, buf2);                                           
>  sprintf(buf, "%sStatus: ", buf);

-=-<*snip*>-=-

This is really just a guess, but I would say that the cause of your problem
lies in splitting into 2 buffers.  Logically, it makes sense, but when the
program gets to this point, you're appending one buffer to another, and then
printing into the first again.  Keep in mind that strcat takes the form:

char *strcat(char *string1, const char *string2); and returns the value of
string1.

  If you try something like: newbuf = strcat(buf, buf2); and then substitute
all remaining instances of buf with newbuf, that might make a difference.

Just guessing... hope you figure it out!

-Chris
lint@jhu.edu

"I swear, by my life and my love of it, that I will never live for the sake
of another man, nor ask another man to live for mine."

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
|    Or send 'info circle' to majordomo@cspo.queensu.ca     |
+-----------------------------------------------------------+



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