Hexadecimal (and readable) Dumper

This is a quick and dirty C program. Many systems have a builtin command to produce this kind of dump. For example, od -t x1z on Debian Linux or hexdump -C on MacOSX. For other systems this program might be considered useful.
% hd hd.c
hd.c:
  0: 23 69 6E 63 6C 75 64 65 20 3C 73 74 64 69 6F 2E  #include <stdio.
 16: 68 3E 0A 23 64 65 66 69 6E 65 20 44 55 4D 50 53  h>.#define DUMPS
 32: 49 5A 45 20 31 36 0A 6D 61 69 6E 28 69 6E 74 20  IZE 16.main(int 
 48: 61 72 67 63 2C 20 63 68 61 72 20 2A 2A 61 72 67  argc, char **arg
 64: 76 29 7B 0A 69 6E 74 20 69 3B 0A 63 68 61 72 20  v){.int i;.char 
 80: 2A 6E 3B 0A 46 49 4C 45 20 2A 66 3B 0A 20 20 69  *n;.FILE *f;.  i
...

Back to ZBEN's home page.