Created
February 25, 2013 00:08
-
-
Save wilkie/5026371 to your computer and use it in GitHub Desktop.
A demostration of what xxd -i will do: It takes any binary file and generates a C-compatible file defining a static array of the contents which can then be #included in.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xxd -i foo.txt > output.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis vulputate | |
nisi non mi adipiscing vulputate. Donec egestas interdum blandit. | |
Phasellus lectus massa, varius vel varius in, congue a lacus. Nunc | |
mauris purus, pulvinar vel blandit non, vestibulum in ante. Sed molestie, | |
leo ac facilisis ornare, odio nulla accumsan purus, vitae adipiscing | |
velit elit vitae nisl. Pellentesque odio nisi, malesuada in suscipit sit | |
amet, lacinia ut tellus. Pellentesque feugiat enim a justo tempor | |
ultricies. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned char moo_txt[] = { | |
0x4c, 0x6f, 0x72, 0x65, 0x6d, 0x20, 0x69, 0x70, 0x73, 0x75, 0x6d, 0x20, | |
0x64, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x73, 0x69, 0x74, 0x20, 0x61, 0x6d, | |
0x65, 0x74, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0xc2, 0xad, 0x73, 0x65, 0x63, | |
0x74, 0x65, 0xc2, 0xad, 0x74, 0x75, 0x72, 0x20, 0x61, 0x64, 0x69, 0x70, | |
0xc2, 0xad, 0x69, 0x73, 0x63, 0xc2, 0xad, 0x69, 0x6e, 0x67, 0x20, 0x65, | |
0x6c, 0x69, 0x74, 0x2e, 0x20, 0x44, 0x75, 0x69, 0x73, 0x20, 0x76, 0x75, | |
0x6c, 0x70, 0x75, 0xc2, 0xad, 0x74, 0x61, 0x74, 0x65, 0x0a, 0x6e, 0x69, | |
0x73, 0x69, 0x20, 0x6e, 0x6f, 0x6e, 0x20, 0x6d, 0x69, 0x20, 0x61, 0x64, | |
0x69, 0x70, 0xc2, 0xad, 0x69, 0x73, 0x63, 0xc2, 0xad, 0x69, 0x6e, 0x67, | |
0x20, 0x76, 0x75, 0x6c, 0x70, 0x75, 0xc2, 0xad, 0x74, 0x61, 0x74, 0x65, | |
0x2e, 0x20, 0x44, 0x6f, 0x6e, 0x65, 0x63, 0x20, 0x65, 0x67, 0x65, 0x73, | |
0xc2, 0xad, 0x74, 0x61, 0x73, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0xc2, | |
0xad, 0x64, 0x75, 0x6d, 0x20, 0x62, 0x6c, 0x61, 0x6e, 0x64, 0x69, 0x74, | |
0x2e, 0x0a, 0x50, 0x68, 0x61, 0x73, 0x65, 0x6c, 0xc2, 0xad, 0x6c, 0x75, | |
0x73, 0x20, 0x6c, 0x65, 0x63, 0xc2, 0xad, 0x74, 0x75, 0x73, 0x20, 0x6d, | |
0x61, 0x73, 0xc2, 0xad, 0x73, 0x61, 0x2c, 0x20, 0x76, 0x61, 0x72, 0xc2, | |
0xad, 0x69, 0x75, 0x73, 0x20, 0x76, 0x65, 0x6c, 0x20, 0x76, 0x61, 0x72, | |
0xc2, 0xad, 0x69, 0x75, 0x73, 0x20, 0x69, 0x6e, 0x2c, 0x20, 0x63, 0x6f, | |
0x6e, 0x67, 0x75, 0x65, 0x20, 0x61, 0x20, 0x6c, 0x61, 0x63, 0x75, 0x73, | |
0x2e, 0x20, 0x4e, 0x75, 0x6e, 0x63, 0x0a, 0x6d, 0x61, 0x75, 0xc2, 0xad, | |
0x72, 0x69, 0x73, 0x20, 0x70, 0x75, 0x72, 0x75, 0x73, 0x2c, 0x20, 0x70, | |
0x75, 0x6c, 0xc2, 0xad, 0x76, 0xc2, 0xad, 0x69, 0x6e, 0x61, 0x72, 0x20, | |
0x76, 0x65, 0x6c, 0x20, 0x62, 0x6c, 0x61, 0x6e, 0x64, 0x69, 0x74, 0x20, | |
0x6e, 0x6f, 0x6e, 0x2c, 0x20, 0x76, 0x65, 0x73, 0x74, 0x69, 0x62, 0x75, | |
0xc2, 0xad, 0x6c, 0x75, 0x6d, 0x20, 0x69, 0x6e, 0x20, 0x61, 0x6e, 0x74, | |
0x65, 0x2e, 0x20, 0x53, 0x65, 0x64, 0x20, 0x6d, 0x6f, 0x6c, 0x65, 0x73, | |
0x74, 0x69, 0x65, 0x2c, 0x0a, 0x6c, 0x65, 0x6f, 0x20, 0x61, 0x63, 0x20, | |
0x66, 0x61, 0x63, 0x69, 0x6c, 0xc2, 0xad, 0x69, 0xc2, 0xad, 0x73, 0x69, | |
0x73, 0x20, 0x6f, 0x72, 0x6e, 0x61, 0x72, 0x65, 0x2c, 0x20, 0x6f, 0x64, | |
0x69, 0x6f, 0x20, 0x6e, 0x75, 0x6c, 0x6c, 0x61, 0x20, 0x61, 0x63, 0x63, | |
0x75, 0x6d, 0xc2, 0xad, 0x73, 0x61, 0x6e, 0x20, 0x70, 0x75, 0x72, 0x75, | |
0x73, 0x2c, 0x20, 0x76, 0x69, 0x74, 0x61, 0x65, 0x20, 0x61, 0x64, 0x69, | |
0x70, 0xc2, 0xad, 0x69, 0x73, 0x63, 0xc2, 0xad, 0x69, 0x6e, 0x67, 0x0a, | |
0x76, 0x65, 0x6c, 0x69, 0x74, 0x20, 0x65, 0x6c, 0x69, 0x74, 0x20, 0x76, | |
0x69, 0x74, 0x61, 0x65, 0x20, 0x6e, 0x69, 0x73, 0x6c, 0x2e, 0x20, 0x50, | |
0x65, 0x6c, 0xc2, 0xad, 0x6c, 0x65, 0x6e, 0xc2, 0xad, 0x74, 0x65, 0x73, | |
0x71, 0x75, 0x65, 0x20, 0x6f, 0x64, 0x69, 0x6f, 0x20, 0x6e, 0x69, 0x73, | |
0x69, 0x2c, 0x20, 0x6d, 0x61, 0x6c, 0x65, 0xc2, 0xad, 0x73, 0x75, 0x61, | |
0x64, 0x61, 0x20, 0x69, 0x6e, 0x20, 0x73, 0x75, 0x73, 0xc2, 0xad, 0x63, | |
0x69, 0x70, 0x69, 0x74, 0x20, 0x73, 0x69, 0x74, 0x0a, 0x61, 0x6d, 0x65, | |
0x74, 0x2c, 0x20, 0x6c, 0x61, 0x63, 0x69, 0x6e, 0x69, 0x61, 0x20, 0x75, | |
0x74, 0x20, 0x74, 0x65, 0x6c, 0xc2, 0xad, 0x6c, 0x75, 0x73, 0x2e, 0x20, | |
0x50, 0x65, 0x6c, 0xc2, 0xad, 0x6c, 0x65, 0x6e, 0xc2, 0xad, 0x74, 0x65, | |
0x73, 0x71, 0x75, 0x65, 0x20, 0x66, 0x65, 0x75, 0xc2, 0xad, 0x67, 0x69, | |
0x61, 0x74, 0x20, 0x65, 0x6e, 0x69, 0x6d, 0x20, 0x61, 0x20, 0x6a, 0x75, | |
0x73, 0x74, 0x6f, 0x20, 0x74, 0x65, 0x6d, 0xc2, 0xad, 0x70, 0x6f, 0x72, | |
0x0a, 0x75, 0x6c, 0x74, 0x72, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2e, 0x0a | |
}; | |
unsigned int moo_txt_len = 564; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment