From: "Ralph Friedman (TeamB)" Subject: Re: Compare files Date: 27 Dec 1999 00:00:00 GMT Message-ID: Content-Transfer-Encoding: 8bit References: <848dhk$mbi3@forums.borland.com> Content-Type: text/plain; charset=iso-8859-1 Organization: Garlin Software Development Corp. Mime-Version: 1.0 Reply-To: ralphfriedman@email.com Newsgroups: borland.public.delphi.winapi In message <848dhk$mbi3@forums.borland.com>, Ivan Petkovic stated: > How can I compare two files and see if they are identical ? > Ivan, assuming you are using a 32-bit version of Delphi and the files are not gigantic: function CompareFiles(AFileName1: string; AFileName2: string): boolean; var file1: TFileStream; file1Text: string; file2: TFileStream; file2Text: string; begin Result := false; file1 := TFileStream.Create(AFileName1, fmOpenRead); try file2 := TFileStream.Create(AFileName2, fmOpenRead); try SetLength(file1Text, file1.Size); SetLength(file2Text, file2.Size); file1.Read(file1Text[1], file1.Size); file2.Read(file2Text[1], file2.Size); Result := file1Text = file2Text; finally file2.Free; end; finally file1.Free; end; end; === Regards Ralph (TeamB) ===