liblash

A bianry tree implementation used for game development from scratch
git clone git://holbrook.no/liblash.git
Log | Files | Refs | LICENSE

fromhex.c (326B)


      1 #include <stdlib.h>
      2 #include <string.h>
      3 #include <stdio.h>
      4 
      5 #include "hex.h"
      6 
      7 int main(int argc, void *argv[]) {
      8 	int i;
      9 	int c;
     10 	unsigned char *bin;
     11 
     12 	if (argc < 2) {
     13 		return 1;
     14 	}
     15 
     16 	c = strlen(argv[1]) / 2;
     17 	bin = malloc(c);
     18 	hex2bin(argv[1], bin);
     19 	for (i = 0; i < c; i++) {
     20 		putchar(bin[i]);
     21 	}
     22 	free(bin);
     23 	return 0;
     24 }