(void*)"Return"

FileToStringLiteral

FileToStringLiteral is a very simple program that converts a file into a literal string for the C language. This allows you to embed files into source code.

If converting PNG images, consider optimizing them first.

The string will be split on regular intervals to make it less hard on your text editor, so the string only works with languages/compilers that automatically concatenate strings when written like this: "first"
"second"
. You can remove the split yourself or add a concatenation operator in-between if you want to or whatever.

How it works

Each byte of the file is read, and then written into the string as whatever code/character corresponds to the same byte value. You can then read the string as binary data from your code.


Current status

There's some options that could be added, for example the ability to configure the string to be compatible with different programming languages, or buttons for opening a file picker or exporting a file. I only use C and need this tool very rarely, so I don't have personal motivation to add more features to it. I may add them some day though.

Send me a message if you want this to work for another programming language, also give me an example of how the string needs to be changed because I probably won't bother researching that myself.

Linux version is planned, I will make it sometime in the future when I get more familiar with Linux development.

Mac version not planned.


Download

FileToStringLiteral 1.0.1

Windows   Download   FileToStringLiteral_1-0-1.zip - 146 KB


Report bugs/problems or request features: find my contact here.