I've been doing more and more work that involves the reading and writing of binary files. What is the easiest way to inspect the bytes stored in a file?

Ideally, If my file was 10 bytes each of which had only the high bit set, I'd be able to browse for it and get output like this:

01 - 10000000
02 - 10000000
03 - 10000000
04 - 10000000
05 - 10000000
06 - 10000000
07 - 10000000
08 - 10000000
09 - 10000000
10 - 10000000

or perhaps this:

01 - 80
02 - 80
03 - 80
04 - 80
05 - 80
06 - 80
07 - 80
08 - 80
09 - 80
10 - 80

Ideally, said tool would work either on a Mac or on Windows.

    Excellent tips both. I did the googling laserlight suggested and found hexdump which rules for now:

    My-Mac:red sneakyimp$ hexdump -vx rgb.raw
    0000000    0000    0000    0000    0000    0000    0000    0000    0000
    0000010    0000    0000    0000    0000    ffff    0000    0000    0000
    0000020    0000    0000
    0000024
    

    The only thing that bums me out is that the line-counts are themselves in hexadecimal. If only I had sixteen fingers!

      Write a Reply...