print-hex data /no-wait
- data : source to examine (file! url! binary! string! port!)
- /no-wait : doesn't stop until the source's end or a Ctrl-c
When launched from the command line, this script accepts a file argument:
$ r3 print-hex.r path/to/my/file
(the script name must not be altered or must be changed too in the "if %print-hex.r =" statement for this to work)
Like the AmigaDOS command "TYPE HEX NUMBER", this function shows binary data with numbered rows of 16 bytes, followed by their ASCII equivalent. Only the non-control pure ASCII values are printed (32 to 126), others are displayed as a single dot "."
It's mainly useful as a debugging tool or to examine unknown data, with cues like magic numbers or ids easily spottable.
For convenience, it pauses every 16 lines, waiting for either a quit command ('q', 'quit', 'x', 'exit'), or a newline to continue. The refinement /no-wait disables this behavior.