[Overview][Resource strings][Constants][Types][Procedures and functions][Index] | Reference for unit 'StrUtils' (#rtl)

# BinToHex

Convert a binary buffer to a hexadecimal string

## Declaration

Source position: strutils.pp line 230

`procedure BinToHex(`
`const BinBuffer: TBytes;`
`BinBufOffset: Integer;`
`var HexBuffer: TBytes;`
`HexBufOffset: Integer;`
`Count: Integer`
`); overload; procedure BinToHex(`
`BinValue: Pointer;`
`HexValue: PWideChar;`
`BinBufSize: Integer`
`); overload; procedure BinToHex(`
`const BinValue;`
`HexValue: PWideChar;`
`BinBufSize: Integer`
`); overload; procedure BinToHex(`
`BinValue: PAnsiChar;`
`HexValue: PAnsiChar;`
`BinBufSize: Integer`
`); overload; procedure BinToHex(`
`BinValue: PAnsiChar;`
`HexValue: PWideChar;`
`BinBufSize: Integer`
`); overload; procedure BinToHex(`
`const BinValue;`
`HexValue: PAnsiChar;`
`BinBufSize: Integer`
`); overload; procedure BinToHex(`
`BinValue: Pointer;`
`HexValue: PAnsiChar;`
`BinBufSize: Integer`
`); overload;`

## Description

BinToHex converts the byte values in BinValue to a string consisting of 2-charachter hexadecimal strings in HexValue. BufSize specifies the length of BinValue, which means that HexValue must have size 2*BufSize.

For example a buffer containing the byte values 255 and 0 will be converted to FF00.

## Errors

No length checking is done, so if an invalid size is specified, an exception may follow.

## See also

HexToBin |  | Convert a hexadecimal string to a binary buffer

Documentation generated on: May 14 2021