Quote:
Originally Posted by xpi0t0s View Post
Code:
unsigned char RR=(unsigned char)(data >> 16);
yup got it. Thank you xpi0t0s.
In a similar fashion I can get the other hexadecimal integers in GG and BB. Like

Code:
unsigned char RR=(unsigned char)(data >> 8);
unsigned char RR=(unsigned char)(data );
Now one half of the problem is solved. So lemme introduce b4 you the other half.

I will perform average operation on respective RR GG and BB values. (By respective RR GG and BB, I mean that there will be other "data" hexadecimal integer values in the question.) At the end of avg operation I will be left with the individual hexadecimal integer values (from the avg operation). Now I want to club them all back to the "long int data" in hexadecimal integer format. So please guide me how to club char RR GG and BB to long int data.

I'll illustrate with an example.
In the above question it was long int data=0x5A0060; And after conversion, RR='5A',GG='00',BB='60'; now I want to perform the reverse operation. i.e. from RR GG BB to data.