Re: [Circle] Code from Snippets Page

From: Professor Hoopster (hoopy@notfoo.res.cmu.edu)
Date: 07/29/96


On Sun, 28 Jul 1996, James Snow wrote:
> ACMD(do_players)
> {
>   int i, count = 0;
> 
>   for (i = 0; i <= top_of_p_table + 1; i++) {
>     sprintf(buf, "%s  %-20.20s", buf, (player_table + i)->name); <-- I
> think it's in here
>     count++;
>     if (count == 3) {
>       count = 0;
>       send_to_char(buf, ch); <---- Or maybe
>       send_to_char("\r\n", ch); <--- one of
>       sprintf(buf, "");  <----- these three
>     }
>   }
> }

Right before the for() loop, after your declarations, add the line:
	*buf = 0;
As it stands now, whatever is in the buffer before the command is called 
is simply appended to, which is not a good idea.
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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