BCC(1) - General Commands Manual

NAME

bcc - binary to C/C++ arrays converter

SYNOPSIS

bcc [-0cs] [-I tab-num] [-i space-num] [-t type] 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.

-I tab-num

Use tab-num count as leading tab indents.

-i space-num

Use space-num count as leading space indents.

-s

Generates a static array.

-t type

Changes the array char type to store the data content which defaults to unsigned char.

EXAMPLES

Create a static const array from an image.

bcc -sc image.png image > image.h

Create a modifiable char NUL-terminated array from a text file

bcc -0 -t char 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)

AUTHORS

The bcc utility was written by David Demelier <markand@malikania.fr>.

macOS 13.5 - April 13, 2021