in reply to Recreating a binary file from hex representation
One Byte can be 0 to FF in hex. If you have a stream of hex characters, how can you know you have 1A (26 in decimal) or two numbers, 1 and 10?printf("%X", ord($buffer))
say
to make shure each byte is represented by 2 chars (e.g. 0A for decimal 10 instead of just A). Converting back you have to read 2 Bytes each time.printf("%02X", ord($buffer))
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|