AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

find hex codes in files

Ein Thema von cdkiller · begonnen am 23. Jul 2004 · letzter Beitrag vom 24. Jul 2004
 
ripper8472

Registriert seit: 17. Aug 2003
275 Beiträge
 
#2

Re: find hex codes in files

  Alt 24. Jul 2004, 05:18
du musst zuerst die hex werte in normale binärdaten umwandeln. die prozedur dazu steht weiter unten.
wenn du deine hex werte in etwas brauchbares umgewandelt hast, dann lade die datei in einen string und benutze pos(), um nach deinem string zu suchen. du könntest auch selber eine suchfunktion schreiben, die direkt mit der datei arbeitet. such dazu nach vorkommen des ersten zeichens von deinem suchstring. wenn du ein vorkommen gefunden hast, dann prüfe, ob die folgenden zeichen in der datei auch übereinstimmen.

Gruß, Christoph



you first need to convert your hex data to binary as it is saved in your file.
use this procedure and extend it to your needs (it is not tested and may need modifications):
Delphi-Quellcode:
function hextochar(hexstring:string[2]):char;
var
  i:integer;
  c:char;
  hexchars:string;
begin
  hexchars:='0123456789ABCDEF';
  c:=char((pos(hexstring[2],hexchars)-1) or ((pos(hexstring[1],hexchars)-1) shr 4));
  result:=c;
end;
once you have converted your search data, you can load the file (hopefully not a large one) into a string and then use pos(yourdata,filedata).
you could also write a custom find function that works directly with that file. just read char by char and check if it matches yourdata[1] (first char of the string you want). if it matches, then proceed by checking the next char in file against yourdata[2] and so on.
Christoph
char l[]="\xd6N\x96\xa6\xe6\xce.\xa6\xe4\xce\x04N\x86\xae\ xce\xfc",I,*i=l-1;for(;I=3,*i
++;){while(*i=*i&~(1<<I|1<<7-I)|(*i&1<<I)<<7-2*I|(*i&1<<7-I)>>7-2*I,I--);}puts(l);
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:26 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz