manpp: add support for .EX and .EE code blocks
[rofl0r-hardcore-utils.git] / bin2hex.c
blobd64f4aeba50e0b2a223616ebcfa89c13997a71f9
1 #include <stdio.h>
2 #include <stdlib.h>
4 static int syntax() {
5 printf("bin2hex - converts a file into a hex string\n"
6 "he output is written to stdout\n"
7 "bin2sh filename\n");
8 return 1;
11 int main(int argc, char** argv) {
12 if(argc != 2) return syntax();
13 FILE *f = fopen(argv[1], "r");
14 if(!f) { perror("fopen"); return 1; }
15 unsigned char buf[1];
16 while(fread(buf, 1, 1, f)) {
17 printf("%02x", buf[0]);
19 printf("\n");
20 fclose(f);
21 return 0;