delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/01/12:20:25

Date: Thu, 1 Jul 1999 19:16:42 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Tom Beauchamp <tomtomb AT geocities DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Argument problem
In-Reply-To: <7lfub9$b64@nnrp1.farm.idt.net>
Message-ID: <Pine.SUN.3.91.990701191601.7049B-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, 1 Jul 1999, Tom Beauchamp wrote:

> int main(int argc, char *args[]) {
>     if (args[1] == "hello") cout<<"Hello";
>     return 0;
> }
> 
> Produces no output when called with "program hello". Why not?

You cannot compare strings with the "==" operator.  You need to use 
strcmp or some similar function instead.

- Raw text -


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