in reply to pack function

Your question cannot really be answered without knowing what binary format you need. For example, you could pack the integer into 16, 32 or 64 bits, in little- or big-endian format etc. Similarly for the other types.

Depending on what you need, you'd pick the respective letters (as documented in pack) for the format template, e.g. 'N' if you want the integer to be stored as an unsigned 32-bit value in big-endian order...