Ruby unpack binary
问题 I am working on unpacking a binary file for the first time in Ruby. Already found the unpack method which works pretty nice. Which according to the docs works perfect for 8(1 byte),16(2 byte),32(4 byte) and 64 bit(8 byte). But now I have to unpack 5 bytes. How do I do this? Thx in advance! 回答1: To literally unpack five bytes: str.unpack 'C5' That gives you five byte values as unsigned ints. The question is how to reinterpret those ints as a single data type. Pack/unpack only recognize the