|
bintod / bin2d 1.0
Convert binary files to D.
Download bintod.
Includes source and Microsoft Windows executable.
The source should be portable for any platform. Screenshot.
Bintod accepts an input file that will be converted to a D source file;
this source file will contain an array of bytes from the input file.
This allows you to embed files right in your D source projects for
easy access, not requiring you to load external files or use resources.
Examples where this would be useful:
-
Installers; embed the program right in the setup file.
Simply write out this binary array to file and the program is extracted,
or zip it and use std.zip or std.zlib.
-
Quick access to images and other multimedia
without having to load from external files or resources.
For example, fast loading graphics in a game.
-
Libraries, where you typically do not want to force the library
user to package external files or resources with their program.
-
Any other files that will be useful to embed in your program or library.
Usage:
bintod [<switches>] <infile> [<outfile>]
Switches:
-n New output file; do not append
-p Preserve case of identifier; do not force uppercase
-l Next argument is line ending: lf, cr or crlf
-var Make a variable instead of const
-id Next argument is identifier name
Example:
bintod -l crlf -var -id clownPicture clown.jpg clown.d
|