• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

C programming help

cHeeZeFacTory

Golden Member
Hi

I need some quick C programming help.

I need to write a function processes a 8 byte hex message.

How do I break up the hex message in an array of size 8 ? so i can access each byte individually?
 
unsigned int hex = 0x123456787; // 4 bytes
unsigned char arr[4]; // array of 4 bytes
int index = 0;

for( index; index<4; index++ )
{
// shift the hex number over by a byte and store the least significant byte in arr
// NOTE: the value of hex remains the same, we are just shifting it an extra byte each time
arr[index] = (hex >> index*8) & 0x00ff;
}

what is &gt and &amp doing?
 
&gt = >

&amp = &

the >> is the bitshift operator
and & is the bitwise & operator

The attach code function in FuseTalk is broken atm...and has been for awhile so it parses out those signs into their html values instead of leaving them be 🙁
 
Back
Top