Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Binärcode/Hex (https://www.delphipraxis.net/63305-binaercode-hex.html)

hmbg 16. Feb 2006 16:04


Binärcode/Hex
 
Hi,
ich würde gerne wissen, wie man mit Delphi an den Hex Code oder den Binärcode einer Datei rankommt.
Ich hoffe, das passt hier rein, ich wüsste nich, wo ich sonst reinposten sollte.

thx hmbg

Luckie 16. Feb 2006 16:07

Re: Binärcode/Hex
 
Meinst du so was:
http://www.michael-puff.de/Developer...HexLoader.html

hmbg 16. Feb 2006 16:09

Re: Binärcode/Hex
 
hey, klasse, Danke, das ist genau das, was ich suche

mfg hmbg

ichbins 16. Feb 2006 16:26

Re: Binärcode/Hex
 
du liest das Teil einfach Byte für Byte ein und zerlegst das Byte dann in je 2 Hex-Ziffern:
Delphi-Quellcode:
const
  hexes:string='0123456789ABCDEF';
var
  f:file of byte;
  b:byte;
begin
  assignfile(f,dateiname);
  reset(f);
  while not eof(f) do begin
    read(f,b);               // teilungsergebniss von b durch 16 / Teilungsrest
    hexwertvondiesembyte:=hexes[(b div 16)+1]+hexes[(b mod 16)+1];
  end;
  closefile(f);
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:02 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz