Delphi Binary Data

This post shows some code snippets for getting data from Delphi Byte arrays (TBytes) and TMemoryStream’s in and out of Chilkat. First, here are some code snippets to convert from a TMemoryStream to a byte array, and back. Delphi TBytes to TMemoryStream

Delphi DLL – GetBytesPtr (Writing PByte to TStream)

Chilkat v9.5.0.80 adds a new BinData function named GetBytesPtr.   It returns a pointer to the internal bytes contained within the BinData.   This post shows one way of writing those bytes to a Delphi TStream (using the Chilkat non-ActiveX Delphi DLL). procedure TForm1.Button2Click(Sender: TObject); var rawBytes: PByte; ItemCount: Integer; binDat: HCkBinData; Stream: TMemoryStream; Writer: TBinaryWriter; byteArr: TBytes; numBytes: Integer; i: Integer; […]