cprover
converter.cpp File Reference
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
#include <cstring>
+ Include dependency graph for converter.cpp:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 Loads a binary file into a c array and creates c and h files to access it from code. More...
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Loads a binary file into a c array and creates c and h files to access it from code.

This program takes two arguments, a name and a path to a file. It loads the given file (usually a .jar file) and dumps to the standard output a header file with two macros, looking like this:

\#define MYNAME_DATA 0x01 0x23 0xf4 0x8e 0x9a
\#define MYNAME_SIZE 5

The name is used as the prefix for the macros (MYNAME in the example above). The output content, when included from a C/C++ file, can be used to define an array initialized to the contents of the file, like this:

const char myarray[] = { MYNAME_DATA };
const size_t myarray_size = MYNAME_SIZE;

Definition at line 36 of file converter.cpp.