Bin2h - Win32 binary to C header file converter

A Win32 command-line utility for converting a binary file into a C header file, representing the contents of that file as a block of data.

License

Free of charge for unmodified non-commercial use; please contact me for anything else including custom versions, redistribution permission or commercial use.

Usage

Download the tool from here.

You must give the input file as the first argument; optionally you may specify the output filename (otherwise this defaults to the input filename with the extension changed to .h), the variable name, and the switch -nosize to suppress the creation of a variable representing the size of the data block created.

Syntax

bin2h <input filename> [<output filename> [<variable name> [-nosize]]]

Input filename Required Identifies the file to be converted.
Output filename Optional Defaults to the input filename with the extension changed to '.h'.
Variable name Optional Defaults to the output filename with the extension removed.
-nosize Optional If this switch is not present, an integer variable representing the size of the char array will be created, with the same name with _size appended. If present, this variable will not be created.

Example

bin2h bin2h.exe bin2h.h -nosize

This will create a file, bin2h.h, which defines a variable of type unsigned char [] named bin2h, but will not define the variable bin2h_size which would otherwise indicate the size of that array.

Known bugs

None so far!


Valid XHTML 1.1! Valid CSS! [Valid Atom 1.0]