From owner-freebsd-questions@FreeBSD.ORG Sun Oct 16 23:06:55 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 691C31065670 for ; Sun, 16 Oct 2011 23:06:55 +0000 (UTC) (envelope-from kline@thought.org) Received: from thought.org (plato.thought.org [209.180.213.209]) by mx1.freebsd.org (Postfix) with ESMTP id 4820D8FC08 for ; Sun, 16 Oct 2011 23:06:55 +0000 (UTC) Received: by thought.org (Postfix, from userid 1001) id D343AE805CE; Sun, 16 Oct 2011 16:06:54 -0700 (PDT) Date: Sun, 16 Oct 2011 16:06:54 -0700 From: Gary Kline To: Polytropon Message-ID: <20111016230654.GB1112@thought.org> References: <20111016212628.GA30284@thought.org> <20111016235803.40b2181a.freebsd@edvax.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111016235803.40b2181a.freebsd@edvax.de> Organization: Thought Unlimited. Public service Unix since 1986. Of_Interest: With 25 years of service to the Unix community. User-Agent: Mutt/1.5.21 (2010-09-15) Cc: FreeBSD Mailing List Subject: Re: need to check for hex in C: how/ X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2011 23:06:55 -0000 On Sun, Oct 16, 2011 at 11:58:03PM +0200, Polytropon wrote: > Date: Sun, 16 Oct 2011 23:58:03 +0200 > From: Polytropon > Subject: Re: need to check for hex in C: how/ > To: Gary Kline > Cc: FreeBSD Mailing List > X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) > > On Sun, 16 Oct 2011 14:26:31 -0700, Gary Kline wrote: > > > > if n == 15 and x is the int. i can say > > > > if ((int)x == 15) Or to check if x == 'A' i can cast x to (char)x. > > > > what's the syntax to chec if x is , say, 32/ > > The integer types are automatically casted, no matter if > you compare (int) or (char) to a numerical or character > value. > > int i; > char c; > > if(i == 32 || i == ' ') ... > if(c == 32 || c == ' ') ... > > Functions or macros that deal with characters usually > do return (int), even though one would expect (char). > > this will bbe my 'sanity-checck' of sorts. the ck function will have something like: if ((char)x == 'a') { } > > > -- > Polytropon > Magdeburg, Germany > Happy FreeBSD user since 4.0 > Andra moi ennepe, Mousa, ... > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" -- Gary Kline kline@thought.org http://www.thought.org Public Service Unix Journey Toward the Dawn, E-Book: http://www.thought.org The 8.51a release of Jottings: http://jottings.thought.org