Convert Uint32 to byte[4]
C#
3
Posts
3
Posters
0
Views
1
Watching
-
How to convert an uint32 integer to a byte[4]? Moreover, put the byte[4] into a byte[] buffer. Thanks!
Hello You can try the next code:
uint i = 0xABCDEF12; byte[] bytes = new byte[4] { (byte) (i & 0xFF), (byte) ((i >> 8) & 0xFF), (byte) ((i >> 16) & 0xFF), (byte) (i >> 24) };
With best regards, Andrew Kirillov, MCP x 3 Prize winner, August 2005 -
How to convert an uint32 integer to a byte[4]? Moreover, put the byte[4] into a byte[] buffer. Thanks!