Convert int to char array (easy but...)
- From: clinisbut <clinisbut@xxxxxxxxx>
- Date: Fri, 30 Nov 2007 05:13:12 -0800 (PST)
What I want to do exactly is this:
I need to split (in a binary way) an Int into two bytes.
Something like:
int value : 340
same value in binary: 101010100
convert this to 2 bytes:
byte1 = 2 ( 1 in binary );
byte2 = 84 ( 1010100 );
I'm trying to do this but does not work:
byte1 = value>>8;
byte2 = value & 0x00FF;
But gives me wrong values... What I'm doing wrong!?
.
- Follow-Ups:
- Re: Convert int to char array (easy but...)
- From: Chris Dollin
- Re: Convert int to char array (easy but...)
- From: Thomas Fritsch
- Re: Convert int to char array (easy but...)
- Prev by Date: Re: Josephus Flavius Problem Help Please
- Next by Date: Re: Great SWT Program
- Previous by thread: <<<<<<How to earn money through net>>>>>>>
- Next by thread: Re: Convert int to char array (easy but...)
- Index(es):