Download v1.04:
Archive: [48k]
Individual files:
dump.exe, dump.ppj
main.c, gcc_main.c
readme.txt, GPL.txt

by Thomas James
Last updated: 05-Sep-2011
Copyleft Copyleft 2011 Thomas James
Distributed under the GNU GPL v3.

Dump is a Windows command line tool you can use to print binary data in byte-form, in a similar way to the hexdump and od utilities on Unix/POSIX/GNU systems. Some extra options for tweaking the layout have been added. You can dump data from a file, or from standard input via the pipe. Redirection may be used to send the dump to an output file rather than the console. Supported formats are hex, octal, signed decimal, unsigned decimal and ASCII characters.

To install just copy the dump.exe file to any location on your computer and run it from the command line. To use Dump in any directory add the directory containing dump.exe to your PATH environment variable. Usage is as follows:

DUMP filename [/skip n] [/keep n] [/type c] [/address c] [/words] [/condense]
              [/compress] [/noascii] [/replace] [/width n] [/divider c]
              [/head] [/tail] [/lower] > output.txt

Here's an example of Dump in action, printing out the first 128 bytes of its own source code in hex:

Example 1

By default Dump displays the entire file, 16 bytes per line in hexadecimal, with an address/offset marker on the left and an ASCII representation on the right. Optional switches can be used to change data formats and layout:

Switch Description
/? Show help.
/skip n Offset or address where dumping begins. Use a negative value to set an offset from the end of the file.
/keep n Number of bytes to be dumped.
/type c Format for displayed bytes (default hex). Code may be: h - hex, o - octal, d - decimal, u - unsigned decimal, c - char. When displaying in octal or decimal formats it may be necessary to increase the console width buffer or reduce the number of bytes per line with /width to avoid line-wrap.
/address c Format for offset address marker (default hex). Code may be: h - hex, o - octal, u - unsigned decimal, n - no address.
/words Display byte data grouped in 2-byte words.
/condense Display bytes contiguously without spaces or divider.
/compress Display duplicate lines as an asterisk. This can be useful for detecting long blocks of repeating bytes.
/noascii ASCII column will not be displayed.
/replace c Sets the replacement for non printable characters in the ASCII column, or the bytes area when using /type c. Use sp for a space. Dot by default.
/width n Number of bytes to be displayed per line (default 16, max 128).
/divider c Specifies a divider character to be displayed in the middle of the line of bytes, when the number of bytes or 2-byte words on the line is even. Code may be: s - double space, - - hyphen.
/head Display the first 64 bytes of the file only. Equivalent to /keep 64.
/tail Display the last 64 bytes of the file only. Equivalent to /skip -64.
/lower Display alphabetic hex symbols in lowercase.

When no filename is specified, piped data from stdin will be dumped instead:

echo hello world! | dump
type main.c | dump

Numeric operands may be prefixed with 0x for a hex value or 0 for octal, and appended with kb / mb / gb for kilobytes, megabytes, or gigabytes respectively. This can be useful when using /skip and /keep on large files. When seeking through the file a 64-bit integer is used to index the position, so the maximum file size Dump can handle is some 8.4 million terrabytes!

Syntax is case insensitive. Note that switches may be typed in shorthand: /r instead of /replace. If the typed switch is ambiguous (e.g. /co could mean either /condense or /compress) a warning will be displayed and further characters will need to be typed to disambiguate. You may precede the switch name with either / or -.

Upon successful completion Dump will return 0 to the operating system or parent process. The following error codes may be returned:

2 - Invalid syntax
3 - Ambiguous switch
4 - Too many filenames specified
5 - Failed to open file
6 - File empty
7 - Skip position outside bounds of file
8 - Nothing to dump

To compile Dump in GCC use gcc_main.c as follows:

gcc -std=gnu99 -o dump gcc_main.c

2011 Thomas James Last updated 05-Sep-2011