N
Noel Milton
Hi:
Ok, I've just read in up to 65,535 bytes into a char array (using the
recvfrom socket API
call). So I have an array of 8 bit char's (char recvString[ ].
Now, four (4) consecutive bytes somewhere within that array represent a
counter.
How can I take those 4 individual bytes, concatinate the 32bits that
make up those
4 bytes, and assign them to "unsigned int i;". In other words, those
32bits represent
an unsigned counter, and I need to transfer them out of the array, make
an integer out
of those 32bits (8x4) and assign them to "unsigned int i", so I can
then perform some
simple math.
I've tried various methods with no luck and my problem may be
big/little endian.
Does any have portable code snippes for doing this (that won't break
when the
sizeof something chages for example, etc).
Regards,
Noelle Milton Vega
(e-mail address removed)
Ok, I've just read in up to 65,535 bytes into a char array (using the
recvfrom socket API
call). So I have an array of 8 bit char's (char recvString[ ].
Now, four (4) consecutive bytes somewhere within that array represent a
counter.
How can I take those 4 individual bytes, concatinate the 32bits that
make up those
4 bytes, and assign them to "unsigned int i;". In other words, those
32bits represent
an unsigned counter, and I need to transfer them out of the array, make
an integer out
of those 32bits (8x4) and assign them to "unsigned int i", so I can
then perform some
simple math.
I've tried various methods with no luck and my problem may be
big/little endian.
Does any have portable code snippes for doing this (that won't break
when the
sizeof something chages for example, etc).
Regards,
Noelle Milton Vega
(e-mail address removed)