Giter VIP home page Giter VIP logo

binclude's Introduction

binclude

binclude converts binary files to C/C++ arrays

Sometimes we need the binary of a file directly embedded in our C/C++ applications. This tiny program can do that for us.

The program can be built simply with..

gcc binclude.c -o binclude

For usage, run without any arguments..

./binclude 

Which outputs..

binclude converts binary files to C/C++ arrays
    usage:  binclude [filename] [array name] [optional column width] > target.c

Then run binclude with any binary file you need as data in your C/C++ program, optionaly with the column width. This defaults to 8.

./binclude monty.prg monty 4

This will output to stdout..

const unsigned char monty[] = {
    0x00,0x80,0x00,0x70,
    0x00,0x70,0x00,0xc2,
    0xcd,0x38,0x30,0x4c,
    0x89,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,
    0xa9,0x0f,0x8d,0x18,
    0xd4,0xee,0xfa,0x84,
    0x2c,0xee,0x84,0x30,
    0x1e,0x50,0x31,0xa9,
    0x00,0x8d,0xfa,0x84,
    0xa2,0x02,0x9d,0xc4,
    0x84,0x9d,0xc7,0x84,
    0x00,0x00,0x00,0x00,
    0x00,0x00
};

To write this to a file...

./binclude monty.prg monty 4 >monty.c

Should you need different types defined etc it would be very simple for you to edit the source of binclude to meet your needs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.