I am new to C and I have a question regarding a problem I have. I need to get this input: AA BB CC DD
But I get this all time AA BB CC00 DD
The code I am using is :
int main(void) {
unsigned int getal,temp;
printf("Voer een getal in: \n");
scanf("%0X",&getal);
temp = getal & 0xFF000000;
temp=temp>>24;
printf("%0X\n", temp);
temp = getal & 0xFF0000;
temp=temp>>0xFF0;
printf("%0X\n", temp);
temp = getal & 0xFF00;
temp=temp>>0xFF0000;
printf("%0X\n", temp);
temp = getal & 0xFF;
printf("%0X\n", temp);
return 0;
}
I appreciate all the help I can get!
You mean
temp >> 24
,temp >> 16
, andtemp >> 8
. Weird, you got the first one right, why did you suddenly do something totally different?