dougcoulter
Programmer
I have a real problem that is driving me crazy!
I have a floating point (4 bytes) variable that I need to convert into a 4 byte character array. I just want the raw data that makes up the 4 bytes of the float to be directly placed in the character array (no conversion or anything).
For example, if the floating point variable contains the number 22.625 ( = 0100 0001 1011 0101 0000 0000 0000 0000 ), I need a character array to be populated as
ch[0] = 0x41h = 0100 0001b
ch[1] = 0xB5h = 1011 0101b
ch[2] = 0x00h = 0000 0000b
ch[3] = 0x00h = 0000 0000b
Can anyone help me with the code required to accomplish this?
Thank you so much...
...Doug Coulter
I have a floating point (4 bytes) variable that I need to convert into a 4 byte character array. I just want the raw data that makes up the 4 bytes of the float to be directly placed in the character array (no conversion or anything).
For example, if the floating point variable contains the number 22.625 ( = 0100 0001 1011 0101 0000 0000 0000 0000 ), I need a character array to be populated as
ch[0] = 0x41h = 0100 0001b
ch[1] = 0xB5h = 1011 0101b
ch[2] = 0x00h = 0000 0000b
ch[3] = 0x00h = 0000 0000b
Can anyone help me with the code required to accomplish this?
Thank you so much...
...Doug Coulter