MESSAGE
DATE | 2002-04-24 |
FROM | Jon Bober
|
SUBJECT | Re: [hangout] C problem
|
From owner-hangout-desteny-at-mrbrklyn.com Wed Apr 24 13:31:46 2002 Received: (from mdom-at-localhost) by www2.mrbrklyn.com (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) id g3OHVOr18923 for hangout-desteny; Wed, 24 Apr 2002 13:31:24 -0400 Received: from acm.cs.nyu.edu (ACM.CS.NYU.EDU [128.122.20.127]) by www2.mrbrklyn.com (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) with ESMTP id g3OHVOC18916 for ; Wed, 24 Apr 2002 13:31:24 -0400 Received: by acm.cs.nyu.edu (Postfix, from userid 1020) id 9A310BD689; Wed, 24 Apr 2002 13:27:01 -0400 (EDT) Date: Wed, 24 Apr 2002 13:27:01 -0400 From: Jon Bober To: hangout-at-nylxs.com Cc: ruben-at-mrbrklyn.com Subject: Re: [hangout] C problem Message-ID: <20020424172701.GA11814-at-gandalf.nyu.edu> Mail-Followup-To: Jon Bober , hangout-at-nylxs.com, ruben-at-mrbrklyn.com References: <20020424010459.0cb63f54.jwb235-at-nyu.edu> <200204241359.g3ODxTb16130-at-www2.mrbrklyn.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200204241359.g3ODxTb16130-at-www2.mrbrklyn.com> User-Agent: Mutt/1.3.28i Sender: owner-hangout-at-mrbrklyn.com Precedence: bulk Reply-To: Jon Bober List: New Yorkers Linux Scene Admin: To unsubscribe send unsubscribename-at-domian.com to hangout-request-at-www2.mrbrklyn.com X-Keywords: X-UID: 16255 Status: RO X-Status: A Content-Length: 2878 Lines: 106
The value -1 results in "true." The only value that results in "false" is 0.
The C statement: if(x)
is something similar to the assembler statement cmp 0, x
Basically, if(x) means if(x!=0)
On Wed, Apr 24, 2002 at 09:59:29AM -0400, Ruben I Safir wrote: > > Yes > > That's right, but it still doesn't work and I'm not > sure why. When you send CTL D the scanf returns a -1, which I asume is the > EOF result, and the if statement doesn't break. > > > This is why I use Perl > > > Ruben > > > Wow. I feel really stupid. I don't know how that happened. I guess I > > was looking at the warnings. > > > > I think that the problem is one of operator precedence. try: > > if (!(ret=scanf("%255s", buff_key))) > > > > I just tested the two lines > > z = (!y=x); > > > > and > > z = (!(y=x)); > > > > The latter works but not the former. The first is trying to assign the > > value x to !y > > > > On Wed, 24 Apr 2002 01:20:19 -0400 (EDT) > > Ruben I Safir wrote: > > > > > > > > > First, what is g_hash_table_new(), if those warnings are important > > > > to you? > > > > > > > > > > ITs a gtk function which has nothing to do with the problem > > > > > > > > > > Second, hTable must be declared > > > > > > > > > Yahah yadah - it's declared above main where it belongs > > > > > > The error is the lvalue > > > int ret and scanf > > > > > > THIS is the line which is the problem > > > > > > > > if(! ret=scanf("%255s", buff_key)) break; <====LINE 35 > > > > > hash.c:35: invalid > > > > > lvalue in assignment > > > > > > > > > > -- > > > > > __________________________ > > > > > > > > > > Brooklyn Linux Solutions > > > > > __________________________ > > > > > http://www.mrbrklyn.com - Consulting > > > > > http://www.brooklynonline.com - For the love of Brooklyn > > > > > http://www.nylxs.com - Leadership Development in Free Software > > > > > http://www.nyfairuse.org - The foundation of Democracy > > > > > http://www2.mrbrklyn.com/resources - Unpublished Archive or > > > > > stories and articles from around the net > > > > > http://www2.mrbrklyn.com/mp3/dr.mp3 - Imagine my surprise when I > > > > > saw you... http://www2.mrbrklyn.com/downtown.html - See the New > > > > > Downtown Brooklyn.... > > > > > > > > > > 1-718-382-5752 > > > > > > > > > > > > > > > > > > > > ____________________________ > > > > > New Yorker Linux Users Scene > > > > > Fair Use - > > > > > because it's either fair use or useless.... > > > > > > > > > > ____________________________ > > > New Yorker Linux Users Scene > > > Fair Use - > > > because it's either fair use or useless.... > > > > ____________________________ > New Yorker Linux Users Scene > Fair Use - > because it's either fair use or useless.... ____________________________ New Yorker Linux Users Scene Fair Use - because it's either fair use or useless....
|
|