Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#11

Re: Dateien byteweise vergleichen

  Alt 14. Mai 2010, 14:12
Verbesserungsvorschlag:

Delphi-Quellcode:
function ByteCompFiles(const aSourceFile, aDestFile: String): Boolean;
var SourceFile, DestFile: TMemoryStream;
begin
  SourceFile := TMemoryStream.Create;
  DestFile := TMemoryStream.Create;
  try
    SourceFile.LoadFromFile(aSourceFile);
    DestFile.LoadFromFile(aDestFile);
    Result := (SourceFile.Size = DestFile.Size) and
              (CompareMem(SourceFile.Memory, DestFile.Memory, SourceFile.Size));
  finally
    DestFile.Free;
    SourceFile.Free;
  end;
end;
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat