https://github.com/nicolasbauw/bin2source
Command line utility to create a C const array from a file.
https://github.com/nicolasbauw/bin2source
amiga binary byte-array c const-array incbin source
Last synced: 6 months ago
JSON representation
Command line utility to create a C const array from a file.
- Host: GitHub
- URL: https://github.com/nicolasbauw/bin2source
- Owner: nicolasbauw
- Created: 2020-09-22T15:20:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-03T12:43:43.000Z (over 4 years ago)
- Last Synced: 2025-03-30T15:47:33.605Z (10 months ago)
- Topics: amiga, binary, byte-array, c, const-array, incbin, source
- Language: C
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bin2source
Creates a C bytes array from a file.
Usage:
bin2source inputfile outputfile arrayname
Example:
```
echo "abcd" > test.txt
bin2source test.txt test.c TESTARRAY
cat test.c
typedef unsigned char UINT8;
const UINT8 TESTARRAY[5] = {
97,
98,
99,
100,
10,
};
```
You can change the typedef or array type to whatever you want, of course.
With the --amiga commutator (I use it with VBCC for instance), the output will be like:
```
#include
const UBYTE TESTARRAY[5] = {
...
```
I use that in place of the AsmPro INCBIN macro. To use this data in your source, you can make an 'extern' declaration:
```
extern const UBYTE test[5];
```
To compile the bin2source utility, just clone and type ```make```.