RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Classes.HexToBin Function

Converts a string of hexadecimal digits to the corresponding binary value.

Pascal
function HexToBin(Text: PChar; Buffer: PChar; BufSize: Integer): Integer;
C++
int HexToBin(const char * Text, const char * Buffer, int BufSize);

Classes

Call HexToBin to convert the hexadecimal string Text to the binary value it represents. 

Text is a string representation of a hexadecimal value. 

Buffer returns the resulting value in binary. 

BufSize is the size of Buffer. Text needs to point to at least 2*BufSize hexadecimal characters, because each two hexadecimal characters represent one byte. 

HexToBin returns the number of characters in Buffer that have not been used because Text did not contain valid hexadecimal characters ('0'..'f').

Note: The hexadecimal number must use lower-case characters; HexToBind does not recognize upper-case characters.
 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!