simple examples of how to

Wednesday, October 19, 2011

[PYTHON] struct.pack example

struct.pack("!LHL", 1, 0, int(str, 16));

Make a packed network-byte order (!) binary that has type unsigned long (L), unsigned short (H), unsigned long (L),
The values are given as:
  • First unsigned long is 1
  • Second unsigned short is 0
  • Last unsigned long is int(str, 16), where str contains hexadecimal (16) presentation.

No comments:

Post a Comment