Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Converts any file to C char array to embed as resource.

Convert any file to formatted string of hex characters

#!/usr/bin/bash
hexdump -v -e '16/1 "_x%02X" "\n"' $1 | sed 's/_/\\/g; s/\\x  //g; s/.*/    "&"/'

The output can then be copied and assigned to a const char * in a header/source file and referenced as a normal string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.