asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Wed Oct 06, 2004 4:55 am |
|
|
I am assuming for some reason you can't use printf routines to do it for you. In which case all you need to do is shift left or right (depending on wherether or not you want most or least significant digit first) three bit positions at a time. Each three bits give you the octal value. Repeat this process 8 times to give you all 24 bits.
Code: |
long k = 0x147F1E;
int i,j ;
for (i = 0; i<8 ;i++)
{
j := k & 0x7;
k = k >> 3;
// now do something with j......
//..
} |
|
|