From owner-freebsd-questions@FreeBSD.ORG Sun Oct 16 22:08:19 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 1362E106566B for ; Sun, 16 Oct 2011 22:08:19 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (smtp6.infracaninophile.co.uk [IPv6:2001:8b0:151:1:3fd3:cd67:fafa:3d78]) by mx1.freebsd.org (Postfix) with ESMTP id 7FCD88FC18 for ; Sun, 16 Oct 2011 22:08:18 +0000 (UTC) Received: from seedling.black-earth.co.uk (seedling.black-earth.co.uk [81.187.76.163]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.5/8.14.5) with ESMTP id p9GM87uL068668 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Sun, 16 Oct 2011 23:08:07 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.8.3 smtp.infracaninophile.co.uk p9GM87uL068668 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=infracaninophile.co.uk; s=201001-infracaninophile; t=1318802887; bh=LsqY5chhimL15y566b2/vsP4fbnS5LyNZL4xKhENyGw=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Cc:Content-Type:Date:From:In-Reply-To: Message-ID:Mime-Version:References:To; z=Message-ID:=20<4E9B55BF.3090305@infracaninophile.co.uk>|Date:=20S un,=2016=20Oct=202011=2023:07:59=20+0100|From:=20Matthew=20Seaman= 20|User-Agent:=20Mozilla/5.0=20(M acintosh=3B=20Intel=20Mac=20OS=20X=2010.6=3B=20rv:7.0.1)=20Gecko/2 0110929=20Thunderbird/7.0.1|MIME-Version:=201.0|To:=20freebsd-ques tions@freebsd.org|Subject:=20Re:=20need=20to=20check=20for=20hex=2 0in=20C:=20how/|References:=20<20111016212628.GA30284@thought.org> |In-Reply-To:=20<20111016212628.GA30284@thought.org>|X-Enigmail-Ve rsion:=201.3.2|OpenPGP:=20id=3D60AE908C|Content-Type:=20multipart/ signed=3B=20micalg=3Dpgp-sha1=3B=0D=0A=20protocol=3D"application/p gp-signature"=3B=0D=0A=20boundary=3D"------------enigFF2D72D1017D4 7DCEDBA86E3"; b=pWIMW245JFHWF4aHZIf0UVSZv5bGWjYCslJwgHAuTj8MmccJm0FR+cSj6xa3wNRQ/ sjCRlC/YA0RxCWpoixGU1tXrDqJnNEfXz5Q9qKAMwMBiyLbNZlilCk7d4wC05Puw4+ RYP13CMwT+qw/KnfXRmlCzrudUw+C2nqIce7GIyc= Message-ID: <4E9B55BF.3090305@infracaninophile.co.uk> Date: Sun, 16 Oct 2011 23:07:59 +0100 From: Matthew Seaman User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <20111016212628.GA30284@thought.org> In-Reply-To: <20111016212628.GA30284@thought.org> X-Enigmail-Version: 1.3.2 OpenPGP: id=60AE908C Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigFF2D72D1017D47DCEDBA86E3" X-Virus-Scanned: clamav-milter 0.97.2 at lucid-nonsense.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_FAIL autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lucid-nonsense.infracaninophile.co.uk 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 22:08:19 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigFF2D72D1017D47DCEDBA86E3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 16/10/2011 22:26, Gary Kline wrote: > if n =3D=3D 15 and x is the int. i can say=20 >=20 > if ((int)x =3D=3D 15) Or to check if x =3D=3D 'A' i can cast x to (cha= r)x. >=20 > what's the syntax to chec if x is , say, 32/ In C code you can write an integer constant in hexadecimal by prefixing it with 0x -- so 0x32 is the hexadecimal constant equal to decimal 50. if ( x =3D=3D 0x32 ) ... I guess that's what you're asking; '32/' is not any sort of syntax I've ever seen before to indicate hexadecimal. Cheers, Matthew Tempted to interpret it as 32 shillings old money (=A31.60 in decimal coi= nage) --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate JID: matthew@infracaninophile.co.uk Kent, CT11 9PW --------------enigFF2D72D1017D47DCEDBA86E3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.16 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk6bVcYACgkQ8Mjk52CukIzPjgCfbbN/5V6VeQzB5tNTv/au9obn Dm8AoJV52+YBYtvWQfLK0QzhuPKHGl29 =tlsK -----END PGP SIGNATURE----- --------------enigFF2D72D1017D47DCEDBA86E3--