Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^2: Losing Bits with Pack/Unpack

by o0lit3 (Friar)
on Sep 17, 2020 at 11:55 UTC ( #11121873=note: print w/replies, xml ) Need Help??

in reply to Re: Losing Bits with Pack/Unpack
in thread Losing Bits with Pack/Unpack

Is "unpack" byte aligned also? If I have not lost any data with the unpack'(H5)%' step, I am wondering how one would go about reversing the process.

Replies are listed 'Best First'.
Re^3: Losing Bits with Pack/Unpack
by Eily (Monsignor) on Sep 17, 2020 at 12:42 UTC

    Yes unpack is also byte aligned. unpack moves exactly like pack does given the same pattern, except it reads instead of writes. You did lose data with H5, that's why some chars were changed. One way to see that is to try "hehlo" or "hemlo" instead of hello. You'll see that you get the same result, because four bits in the byte are replaced by 0000 when pack was only given 5 hex digits for 3 bytes.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11121873]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2023-06-01 10:06 GMT
Find Nodes?
    Voting Booth?

    No recent polls found