copyfile(source,dest,overwrite)overwrite参数true:是覆盖
false:是不覆盖可是我用的结果是恰恰相反,false为覆盖,true不覆盖,大家又用过的吗?

解决方案 »

  1.   

    用这个自定Function:
    procedure TForm1.FileCopy(const SourceFileName, TargetFileName: string);
    var
      S, T: TFileStream;
    begin
      S := TFileStream.Create(SourceFileName, fmOpenRead);
      try
        T := TFileStream.Create(TargetFileName, fmOpenWrite or fmCreate);
        try
          T.CopyFrom(S, S.Size);
        finally
          T.Free
        end;
      finally
        S.Free;
      end;
    end;
      

  2.   

    bFailIfExists为False是覆盖。
    The CopyFile function copies an existing file to a new file. BOOL CopyFile(    LPCTSTR lpExistingFileName, // pointer to name of an existing file 
        LPCTSTR lpNewFileName, // pointer to filename to copy to 
        BOOL bFailIfExists  // flag for operation if file exists 
       );
     ParameterslpExistingFileNamePoints to a null-terminated string that specifies the name of an existing file. lpNewFileNamePoints to a null-terminated string that specifies the name of the new file. bFailIfExistsSpecifies how this operation is to proceed if a file of the same name as that specified by lpNewFileName already exists. If this parameter is TRUE and the new file already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.
      

  3.   

    我晕,这是你自己的想法,仔细去看看WIN32 API的说明吧
      

  4.   

    BOOL CopyFile(    LPCTSTR lpExistingFileName, // pointer to name of an existing file 
        LPCTSTR lpNewFileName, // pointer to filename to copy to 
        BOOL bFailIfExists  // flag for operation if file exists 
       );
    bFailIfExists 为true说明如果文件存在的话,就拷贝失败
     为false说明如果文件已经存在的话,也不返回copy失败的信息
      

  5.   


    金山词霸查得:overwrite覆盖。
      

  6.   

    呵呵,实际用下嘛!
    呵呵,函数里面有介绍的哦,你看下delphi帮助文档哦!