Re: more code

From: Kenneth G. Cavness (
Date: 07/13/96

On Sat, 13 Jul 1996, Nick B wrote:

> Now, I am a novice programmer, but I don't see what is wrong with this
> little bit of code in my act.informative.c:
> ACMD(do_score)
> {  
>    struct time_info_data playing_time; 
>    struct time_info_data real_time_passed(time_t t2, time_t t1);
>    sprintf(buf, "%s                   Info for %s\r\n", buf, GET_NAME(ch));
>    sprinttype(GET_RACE(ch), pc_race_types, buf2); 
>    sprintf(buf, "%sRace: %s", buf, buf2);
>    sprinttype(GET_CLASS(ch), pc_class_types, buf2);
>    sprintf(buf, "%s                 Class: %s\r\n", buf, buf2);
>    sprintf(buf,"--------------------------------------------------\r\n");
>    sprintf(buf, "You are %d years old.", GET_AGE(ch));
> When I execute the score command within the mud, it starts printing info on
> the screen starting at the GET_AGE line.  Why won't it print anything above it?

sprintf doesn't actually print the information to the screen. You need to
use send_to_char(buf, ch) after every instance of sprintf.

Why? sprintf changes the text and then puts it in the variable 'buf'.

For more information, see 'man sprintf' or your C documentation.

Kenneth G. Cavness                  |
Assistant Editor                    |
Matrix Information and 		    |	ph#: 1-512-451-7602 fax: 452-0127
Directory Services	            |   Austin, TX

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