zoukankan      html  css  js  c++  java
  • 比较两个文件是否一样

    比较两个文件是否一样

    function AreSameFiles(File1 : TFileName ; File2 : TFileName): Boolean;
    var
      MS1 : TMemoryStream;
      MS2 : TMemoryStream;
    begin
      Result :
    = false;
      MS1 :
    = TMemoryStream.Create;
      
    try
        MS1.LoadFromFile(File1);
        MS2 :
    = TMemoryStream.Create;
        Try
          MS2.LoadFromFile(File2);
          
    if MS1.Size=MS2.Size then
          
    begin
            Result :
    = CompareMem(MS1.Memory , MS2.Memory , MS1.Size);
          
    end;
        Finally
          MS2.Free;
        End;
      
    finally
        MS1.Free
      
    end;
    end;

    procedure TForm2.Button1Click(Sender: TObject);
    begin
      
    if  AreSameFiles(Edit1.Text , Edit2.text) then
      
    begin
        ShowMessage(
    '一样');
      
    end else begin
        SHowMessage(
    '不一样');
      
    end;
    end;
  • 相关阅读:
    LOJ#551 Matrix
    洛谷P5163 WD与地图
    洛谷P4831 Scarlet loves WenHuaKe
    LOJ#6118 鬼牌
    支配树
    线性插值
    PropertiesConfiguration
    ThreadLocal
    Thread
    FastJson
  • 原文地址:https://www.cnblogs.com/ProgramBull/p/1787619.html
Copyright © 2011-2022 走看看