hex2bin

Used to convert ASCII HEX strings to binary data.

The function ignores white space in 'hex' and converts pairs of HEX characters into their equivalent binary representation.

Synopsis

int hex2bin(
void * bin,
const char * hex,
unsigned maxLen );
Parameter Description
bin Output A buffer to receive the binary data
hex Input A string of ASCII HEX characters to be converted
maxLen Input The maximum number of characters that 'bin' can hold

Example

Input – 
hex = "41424300"
maxLen = 4
Output -
bin[4] = "ABC"