Einzelnen Beitrag anzeigen

scp

Registriert seit: 31. Okt 2003
1.120 Beiträge
 
Delphi 7 Personal
 
#8

Re: find hex codes in files

  Alt 24. Jul 2004, 14:24
You can search for 'AddD ' (If it has not less but more than 3 spaces) then you should read the data into a buffer and find out the postion of the version number if you compare the chars until it is <> ' '.

Delphi-Quellcode:
  ThePos := FindInFile('D:\_ftest.txt', 'AddD ', true);
  fs := TFileStream.Create;
  try
    fs.Seek(ThePos + length('AddD '), soFromBeginning);
    fs.ReadBuffer(Buffer, SizeOf(Buffer));
    i := 0;
    repeat
      Inc(i);
    until (Buffer[i] <> ' ') or (i >= SizeOf(Buffer));
  finally
    fs.Free;
  end;
To find the next entry you should add an additional parameter to FindInFile() which contains the current position in the file.
  Mit Zitat antworten Zitat