Skip to content

A simple 1 file program for loading binary files into a header file that gets compiled directly into the executable.

License

Notifications You must be signed in to change notification settings

RandomGamingDev/BinHeaderGen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

BinHeaderGen

A simple 1 file program for loading binary files into a header file that gets compiled directly into the executable.

These headers can be used for C/C++

In the header the binary data is stored in the form of a C-string/char*/char[] with each character representing a byte since C/C++ uses ASCII for characters which uses a byte for each character. This makes it not only easy for manipulation, but also really compacts since there's no need for things like commas inbetween, as it's just the pure binary data put inbetween 2 strings that turn it into a valid header.

Want to incorporate a file into your executable without a file?
Use this!
Simply compile using your favorite C++ 20 compiler (because it's just 1 file you can literally just use g++)
Then run the executable with a parameter like this: ./<exec name> <file path>
Then it'll generate header.h (remember to change the names and use namespaces wherever you want those)
Enjoy!

Storing data this way is perfect for:

  • Avoiding file reading especially for systems where that may not be possible or for avoiding the inherent cost that comes with file reading
  • Keeping things in a single executable
  • Making sure that people don't actually break stuff by messing with files
  • Making certain data harder to access

About

A simple 1 file program for loading binary files into a header file that gets compiled directly into the executable.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages