carray(1) is a tiny but flexible Sortix program that turns a binary file into a C file <https://sortix.org/man/man1/carray.1.html …> <https://gitlab.com/sortix/sortix/blob/master/carray/carray.c …> $ echo foo > bar $ carray bar unsigned char bar[] = { 0x66, 0x6F, 0x6F, 0x0A, };
-
Show this thread
-
Replying to @sortiecat
There are similar tools in https://github.com/richfelker/musl-chartable-tools …, but one particular thing I chose to do differently was not to put the outer declaration/braces inside the output file. Instead you
#include it between the braces.2 replies 0 retweets 2 likes -
Replying to @RichFelker
It's a reasonable approach to not include the wrapping declaration, it also removes the need for a tool for the job (just use od + sed as you say). It's another layer of indirection though, and not super usable. carray(1) makes common cases useful without extra glue.
1 reply 0 retweets 0 likes
In my case, the data is output as integers from another program, and arrayify just formats it to be less offensive to include in a git repo and shit.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.