Mail Archives: djgpp/1997/11/02/09:08:29
Hi.
On Sat, 1 Nov 1997, Klywarre (THE AVATAR) wrote:
> if(strcmp(argv[1], "\\c"))
> when any character is used after the '\' character, the
> message to enter a file name appears ---- not what it's supposed to
> do!!! only when the option is '\c'.
strcmp(s1, s2) returns *0* if s1 and s2 match. So the above test should
be:
if (strcmp(argv[1], "\\c") == 0)
or, equivalently,
if (!strcmp(argv[1], "\\c"))
With the existing code, the message will appear for all arguments other
than \c.
May I add that main() should be:
int main(int argc, char *argv[])
and that it should terminate with a return statement.
Regards,
Mahesh (Mahadevan R.), <mdevan AT iname DOT com>
- Raw text -