Path: utzoo!censor!geac!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!decwrl!mcnc!uvaarpa!haven!mimsy!midway!msuinfo!frith!wille From: wille@frith.uucp (Jeffrey Wille) Newsgroups: comp.sys.amiga Subject: Re: Compairing C values Message-ID: <1991Feb5.173521.10273@msuinfo.cl.msu.edu> Date: 5 Feb 91 17:35:21 GMT Article-I.D.: msuinfo.1991Feb5.173521.10273 References: Sender: news@msuinfo.cl.msu.edu Organization: Michigan State University, College of Engineering Lines: 26 Three things: First, argv[i] is a pointer to a char, not a char. So, you should be looking at *argv[i]. Second, you are using the assignment operator '=' in your 'if' statement, not the comparison one '=='. When you say, if (a = 0) the value of the statement is the value being assigned, i.e., zero. Third, the CLI uses + at the end of a command to signify that it is a continuation, so 'test +' is going to wait for you to type more stuff, and the '+' will be absorbed. Try: #include "workbench/startup.h" main(int argc, char *argv[]) { int a; if ((a = *argv[1]) == '&') printf("Yes it's an '&'\n"); } Hope that helps. _ _ ---------------------------------------------------------------------- ( ) Jeff Wille (wille@frith.egr.msu.edu) ( ) _(_ ^^^^ _^-^_ [KF8HZ] (wille@happy.egr.msu.edu) ( ) ( ) / / \ / _^^_ ( @@) 00 M @ @/ <@@ > >oo< "Never say anything unless you're (_^> (^)/ ( ^ ) o / @ sure everyone feels exactly the Marge Homer Bart Lisa Maggie same way." -- Homer Simpson