随笔 - 2146  文章 - 97 评论 - 11767 trackbacks - 253

procedure FileCopy(const FileFrom, FileTo: string);
var
  FromF,ToF: file;
  NumRead,NumWritten: Integer;
  Buffer: array[1..2048] of Byte;
begin
  AssignFile(FromF, FileFrom);
  Reset(FromF, 1);
  AssignFile(ToF, FileTo);
  Rewrite(ToF, 1);

  repeat
    BlockRead(FromF, Buffer, SizeOf(Buffer), NumRead);
    BlockWrite(ToF, Buffer, NumRead, NumWritten);
  until (NumRead = 0) or (NumWritten <> NumRead);

  CloseFile(FromF);
  CloseFile(ToF);
end;
posted on 2007-12-19 17:49  万一  阅读(...)  评论(...编辑  收藏