From: "Peter Below (TeamB)" <100113.1101@compuXXserve.com> Subject: Re: How to compare binary files? Date: 01 Aug 1999 00:00:00 GMT Message-ID: Content-Transfer-Encoding: 8bit References: <37A40F52.91644FDF@t-online.de> Content-Type: text/plain; charset=iso-8859-1 Organization: TeamB Mime-Version: 1.0 Reply-To: 100113.1101@compuXXserve.com Newsgroups: borland.public.delphi.objectpascal > I need to compare the contents of two binary files (with the same size). How can > I do this. If possible a code snippet would be very appreciated. I'm not yet > familiar with filestreams. > Toni, try this: Function AreFilesEqual( Const file1, file2: String ): Boolean; Var m1, m2: TMemoryStream; Begin Result := False; m1 := TMemoryStream.Create; try m1.LoadFromFile( file1 ); m2:= TMemoryStream.Create; try m2.LoadFromFile( file2 ); If m1.size = m2.size Then Result := CompareMem( m1.Memory, m2.memory, m1.size ); finally m2.free; end; finally m1.free; end End; Peter Below (TeamB) 100113.1101@compuserve.com) No e-mail responses, please, unless explicitly requested!