|
From: Abhijit S. <mu...@gm...> - 2002-09-05 16:19:22
|
----- Original Message -----
I don't see the point. unsigned char is one byte, isn't it? Maximum is 255.
So what sense has compare a variable which max value is 255 with a number
greater?
I remember reading somewhere that unsigned char is one byte in all
computers.
Abhijit Shylanath escribió:
> Hi List,
>
>
>
> I have an unsigned char* with the value 12345678 (as int) and I need to
> compare the first 4 numbers with another value (unsigned char).
>
> Does someone have an idea ???
Greets, Christian.
Is this what you're looking for?
int foo = 12345678;
unsigned char bar = 23;
while(foo > 255)
foo /= 10;
if(foo == bar)
// whatever
----------------------------
True, but the question was asked in that manner, and I answered like that,
even though I suspected that it was a typing error (clever me), to
explain the method. But on reading this now, I realize that he'd asked for
(char *)... so it would be
char *string = "1234567";
int foo = atoi(string);
[etc.]
Hope this (time's post) helps.
___________________________________________________________
Abhijit Shylanath
E-mail: mu...@gm... || ibr...@bi...
Web-site: http://mudeth.tripod.com/
|