本文整理自网络,侵删。
function StreamToHexStr(AStream: TStream): String;
const
HexChars: array[0..15] of Char = '0123456789ABCDEF';
var
i,len: Integer;
begin
len := AStream.Size - AStream.Position;
SetLength(Result, len * 2);
AStream.Read(Pointer(Result)^, len);
for i := len downto 1 do begin
Result[i * 2] := HexChars[Byte(Result[i]) and $0F];
Result[i * 2 -1] := HexChars[(Byte(Result[i]) and $F0) shr 4]
end;
end;
相关阅读 >>
delpni-xe5-android sdk api 层次结构
python4Delphi 示例应用程序在 Delphi 应用程序中运行简单的 python 脚本
Delphi cb_addstring 与lb_addstring的区别?
Delphi firedac 如何按整型(byte)读取 mysql tinyint(1) 类型字段?
更多相关阅读请进入《Delphi》频道 >>