bin2hpp
One day we'll get #embed and std::embed, but today is not that day.
CLI tool for converting files into header files which one can use to directly embed data in their C++ projects.
Building
cargo build
Usage
Basic usage
$ bin2hpp -i ~/my_image.bmp
will generate an my_image_bmp.h
file in your current working directory containing something similar to the following:
// Generated by bin2hpp 0.2.0
#ifndef MY_IMAGE_BMP_H
#define MY_IMAGE_BMP_H
#include <stddef.h>
const size_t MYIMAGE_BMP_LEN = 36000054;
const unsigned char MYIMAGE_BMP[MYIMAGE_BMP_LEN] = {0x42,0x4d,0x36,0x51,0x25, ...}
#else
extern const size_t MYIMAGE_BMP_LEN;
extern const unsigned char MYIMAGE_BMP[MYIMAGE_BMP_LEN];
#endif
Note about CLI arguments
Command line arguments are not positional. The input file path argument is the
only required command line argument. The command line argument parser will
choose the first instance of any provided argument. For example, if you provide
the -i
argument twice; only the first -i ./file/path
will be used. This behaviour
should not be relied upon as the implementation of the command line argument
parser may change at any time.
Description
Binary & text resource inclusion utility designed for embedding data directly in a C++ executable
Languages
Rust
100%