hex2bin

Synopsis

int hex2bin(
void * bin,
const char * hex,
unsigned maxLen );

Description

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.

Example:

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

Parameters

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