need to check for hex in C: how/
Gary Kline
kline at thought.org
Sun Oct 16 23:06:55 UTC 2011
On Sun, Oct 16, 2011 at 11:58:03PM +0200, Polytropon wrote:
> Date: Sun, 16 Oct 2011 23:58:03 +0200
> From: Polytropon <freebsd at edvax.de>
> Subject: Re: need to check for hex in C: how/
> To: Gary Kline <kline at thought.org>
> Cc: FreeBSD Mailing List <freebsd-questions at freebsd.org>
> 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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
--
Gary Kline kline at 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
More information about the freebsd-questions
mailing list