function fileSame(fName1,fName2: string): boolean;<br>var fFile1,fFile2 : file of Byte;<br> temStr1,temStr2 : byte;<br> fSize1,fSize2 : longint;<br> bsame : boolean;<br>begin<br> result := False;<br> bSame := True;<br> if (not(fileExists(fName1))) or( not (fileExists(FName2))) then exit;<br> AssignFile(fFile1,Fname1);<br> AssignFile(fFile2,Fname2);<br> reset(fFile1);<br> reset(fFile2);<br> fSize1 := FileSize(fFile1);<br> FSize2 := FileSize(fFile2);<br> if fSize1<>fSize2 then begin//看長度是否一樣<br> closeFile(fFile1);<br> closeFile(fFile2);<br> exit;<br> end;<br> while Not Eof(fFile1) do begin<br> read(fFile1,temStr1);<br> read(fFile2,temStr2);<br> if temStr1<>temStr2 then begin<br> bSame := False;<br> break;<br> end;<br> end;<br> closeFile(fFile1);<br> closeFile(fFile2);<br> result := bSame;<br>end;<br>是一個字節一個字節比較,