An open API service indexing awesome lists of open source software.

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.

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```.