Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codeplea/hexembed
A small utility to embed files into C or C++ programs.
https://github.com/codeplea/hexembed
Last synced: 6 days ago
JSON representation
A small utility to embed files into C or C++ programs.
- Host: GitHub
- URL: https://github.com/codeplea/hexembed
- Owner: codeplea
- License: zlib
- Created: 2018-07-20T16:32:25.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-07-20T17:48:01.000Z (over 6 years ago)
- Last Synced: 2024-08-02T07:12:30.769Z (3 months ago)
- Language: C
- Homepage: https://codeplea.com/embedding-files-in-c-programs
- Size: 5.86 KB
- Stars: 46
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-game-engine-dev - HexEmbed - Small utility to help embed files in C/C++ programs in an easy, cross-platform way. (Libraries / C)
- AwesomeCppGameDev - hexembed
README
# hexembed
hexembed is a very small utility to help embed files in C or C++ programs in an easy, cross-platform way.
## Usage
```
> gcc hexembed.c -o hexembed
> hexembed some_file.jpg > some_file.c
> cat some_file.c/* Embedded file: some_file.jpg */
const int fsize = 1873;
const unsigned char *file = {
0x2f,0x2a,0x0a,0x20,0x2a,0x20,0x68,0x65,0x78,0x65,0x6d,0x62,0x65,0x64,0x20,0x2d,
0x20,0x61,0x20,0x73,0x69,0x6d,0x70,0x6c,0x65,0x20,0x75,0x74,0x69,0x6c,0x69,0x74,
0x79,0x20,0x74,0x6f,0x20,0x68,0x65,0x6c,0x70,0x20,0x65,0x6d,0x62,0x65,0x64,0x20,
0x66,0x69,0x6c,0x65,0x73,0x20,0x69,0x6e,0x20,0x43,0x20,0x70,0x72,0x6f,0x67,0x72,
...
};
```Now you can simply `#include "some_file.c"` file in your program, and you have access to that file's data.
You can find more info and alternative methods here: https://codeplea.com/embedding-files-in-c-programs