Re: argument help

From: Zeavon Calatin (
Date: 02/02/00

>     if (command_arg == "diag")
>       send_to_char("Testing...\r\n", ch);
>     if (command_arg == "testing")
>       send_to_char("Testing...\r\n", ch);

You can't compare strings with == in C. You have to use a function
(conviently provided for you) to do this. Like so:

if (!strcmp(command_arg, "diag"))
  send_to_char("Diag...\r\n", ch);

if (!strcmp(command_arg, "testing"))
  send_to_char("Testing...\r\n", ch);

For more info type 'man strcmp' at your unix prompt. Not using unix? Search
through the MSVC++ helpfiles and pray that they tell you something useful.

> How come when I type 'say diag' or 'say testing' it does not work?

Always find code that does something similar to what you are attempting to
do and emulate how it is done. However, keep in mind (at all times with all
code) that the methods that you are copying may not be the best. With
software engineering there will almost always be more than one way to solve
a problem and, unlike math, more than one answer can be the correct answer.

Zeavon Calatin, Spear of Insanity    telnet://

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 04/10/01 PDT