var
FileBuff: TBytes;
Pattern: TBytes;
begin
FileBuff := filetobytes(filename);
Result := CompareMem(@Pattern[0], @FileBuff[0], Length(Pattern));
end;
Is there any function such as
Result := Pos(@Pattern[0], @FileBuff[0]);
var
FileBuff: TBytes;
Pattern: TBytes;
begin
FileBuff := filetobytes(filename);
Result := CompareMem(@Pattern[0], @FileBuff[0], Length(Pattern));
end;
Is there any function such as
Result := Pos(@Pattern[0], @FileBuff[0]);
Write your own. No optimization can be done when looking for just one byte, so any implementation you'll find would basically do the same thing.
Written in browser:
I think this does it: