{函数}
function BytestoHexString(ABytes: TBytes; len: Integer): AnsiString;
begin
  SetLength(Result, len*2);
  BinToHex(@ABytes[0], PAnsiChar(Result), len);
end;

{测试}
procedure TForm1.FormCreate(Sender: TObject);
var
  bs: TBytes;
  rStr: AnsiString;
begin
  bs := BytesOf('ABCDEFG');
  rStr := BytestoHexString(bs, Length(bs));
  ShowMessage(rStr); //41424344454647
end;

posted on 2011-01-27 18:17  万一  阅读(8026)  评论(2编辑  收藏  举报