Re: [CODE] More About Arguments

From: Brian Williams - Nashak (bmw@EFN.ORG)
Date: 10/03/97


If I'm not mistaken, atoi just returns 0 always. Like atoi("Nashak") = 0,
it just changes it to an integer.

On Fri, 3 Oct 1997, Aaron Miller wrote:

> I am writing a (rather lengthy) function in magic.c, called do_grasp.
> I followed the instructions on adding new commands in coding.doc, namely
> the argument part. Heres what I have
>
> int do_grasp(struct char_data * ch, char *argument, int cmd, int subcmd)
> {
> int argu;
> /* other declarations that are irrelevent snipped */
>
> skip_spaces(&argument);
> one_argument(&argument, buf);
> argu = atoi(buf); /* i need an integer to work worth */
>
> sprintf(buf, "Argument: %d\r\n", argu);
>
> /* snip rest of function, completely irrelevent */
> }
>
> I always, no matter what, get 0. What am I doing wrong, here? I followed
> the instructions for using arguments as best I could. Thanks for
> any/all help.
>
>
>      +------------------------------------------------------------+
>      | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>      | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
>      +------------------------------------------------------------+
>

       /-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+-=-=-=-=-=X=-=-=-=-=-=-=-=-=-=-=-\
       |  Brian M. Williams          | 02/02/83 | bmw@efn.org          |
       X=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+=-=-=-=-=-+-=-=-=-=-=-=-=-=-=-=-=X
       | Boccob the Uncaring, Lord of All Magic | Nashak Stonehand     |
       | accolademud.hermesnet.net 5000         | coyote.toon.org 6000 |
       \=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-X-=-=-=-=-=-=-=-=-=-=-=/


     +------------------------------------------------------------+
     | 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/08/00 PST