BCC(1) - General Commands Manual

NAME

bcc - binary to C/C++ arrays converter

SYNOPSIS

bcc [-0csu] [-I tab-indent] [-i space-indent] filename variable

DESCRIPTION

The bcc utility converts the input file into a C or C++ array named variable that can be embedded as-is in the source code. A special - value can be passed as input which will read standard input instead.

The variable can contain any character but only ones that are allowed in the C standard will be kept, other will be replaced with a “_”. Also, the extension (by finding the first .) is removed as well. This can be handy when generating a lots of file based on their names during a build process.

Note: you must still not start a variable name with digits.

The following options are available:

-0

Terminate the generated array with a trailing NUL.

-c

Generates a const array.

-s

Generate a static array.

-u

Use an unsigned char rather than signed.

-I tab-indent

tab-indent count as leading indents.

-i space-indent

space-indent count as leading indents.

EXAMPLES

Create a static, const, unsigned array from an image.

bcc -scu image.png image > image.h

Create a modifiable array from a text file as a NUL terminated string.

bcc -0 text.txt text > text.h

HISTORY

The bcc tool is inspired by xxd utility but offers more flexibility over the the generated code.

SEE ALSO

xxd(1)

Mac OS X 10.15 - October 21, 2020