1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45:
| var filer, stelle : String; x : widestring; f : file; u : array[0..65535] of char; i, i1, iRead, iWrite, found : integer; begin found := 2; filer := EmptyStr;
{$I-} AssignFile(f, Form1.Edit1.Text); Reset(f,1); filer := ''; for i := 0 to (Memo1.lines.count -1) do begin stelle := Memo1.lines[i]; for i1 := 0 to (Length(Memo1.lines[i])) do begin if not (i1 = 0) then begin filer := filer + stelle[i1] + #0; end; end; repeat BlockRead(f , u, sizeof(u), iRead); if (iRead = Length(filer)) then begin If (Length(filer) = Length(u)) and CompareMem(PChar(filer), @u, Length(filer)) Then found := 1; If (Length(filer) = Length(u)) and CompareMem(@filer, @u, Length(filer)) Then found := 1; If (Length(filer) <> Length(u)) or not CompareMem(PChar(filer), @u, Length(filer)) Then found := 0; If (Length(filer) <> Length(u)) or not CompareMem(@filer, @u, Length(filer)) Then found := 0; if (found = 0) then begin Seek(f, FilePos(F) - Length(filer) - 24); showmessage(IntToStr(FilePos(f))); fillchar(u,sizeof(u),$ff); BlockWrite(f,u,3,iWrite); Seek(f, FilePos(f) + Length(filer) + 25); end; end; until(iRead = 0); end; CloseFile(f); {$S+} |