Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ConvertDataToAscii(Buffer: Pointer; Length: Word): string;
- var
- Iterator: Integer;
- AsciiBuffer: string;
- begin
- AsciiBuffer := '';
- for Iterator := 0 to Length - 1 do
- begin
- if char(Pointer(Integer(Buffer) + Iterator)^) in [#32 .. #127] then
- AsciiBuffer := AsciiBuffer + ' ' +
- char(Pointer(Integer(Buffer) + Iterator)^) + ' '
- else
- AsciiBuffer := AsciiBuffer + ' . ';
- end;
- Result := AsciiBuffer;
- end;
- function ConvertDataToHex(Buffer: Pointer; Length: Word): string;
- var
- Iterator: Integer;
- HexBuffer: string;
- begin
- HexBuffer := '';
- for Iterator := 0 to Length - 1 do
- begin
- HexBuffer := HexBuffer +
- IntToHex(Ord(char(Pointer(Integer(Buffer) + Iterator)^)), 2) + ' ';
- end;
- Result := HexBuffer;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement