delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/02/09:08:29

Date: Sun, 2 Nov 1997 19:39:39 +0530 (IST)
From: "Mahadevan R." <mdevan AT md2 DOT vsnl DOT net DOT in>
Reply-To: "Mahadevan R." <mdevan AT md2 DOT vsnl DOT net DOT in>
To: "Klywarre (THE AVATAR)" <mortral AT ix DOT netcom DOT com>
Cc: djgpp AT delorie DOT com
Subject: Re: Newbie help
In-Reply-To: <345C1F21.723C@ix.netcom.com>
Message-Id: <Pine.OSF.3.95.971102192945.4452B-100000@md2.vsnl.net.in>
Mime-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019