Re: [code] error in string parsing

From: Daniel Koepke (dkoepke@CALIFORNIA.COM)
Date: 04/09/98


Raven Jade Kenago wrote:
>
> However, it gets odd errors, especially on two word spells.. it gets
> garbage characters in there and
> I have absolutely no idea why. Any help? Snippet following that's
> causing the problem
>
>   *tempbuf = '\0';
>
>   while (*argument && !isdigit(*argument)) {
>     tempbuf[x] = *argument;
>     x++;
>     argument++;
>   }
>

    tempbuf[x] = '\0';

That caps tempbuf[] with a terminating NUL, making it a valid C
string (which are always terminated by '\0').

-dak


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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