Sep 19, 2009, 7:30 PM
Post #1 of 3
How to modify a part of a binary data?
here is a simple question.
Suppose that I have some binary data stored in $data (a scalar variable). For simplicity assume, that the length of $data is 5 bytes which can be interpreted as one byte + one integer packed together. I want to modify the integer in a way that is similar to the function vec:
In other words, I do not want to unpack the data into an array of a byte and an integer, modify the integer, then pack it again. I would rather do it directly if it was possible. Any suggestions?