本人有如下的源程序,不知合你意否?!
Var
Infile,OutFile:File;
NumRecsRead:integer;
Buf:array[1..4096] of Byte;
begin
If FileExists(SourceFile) then
begin
AssignFile(InFile,SourceFile);
AssignFile(Outfile,TargetFile);
Reset(InFile,1);
Rewrite(OutFile,1);
While Not Eof(InFile) Do
Begin
BlockRead(InFile,Buf,SizeOf(buf),NumRecsRead)
{读4k字节进缓冲区}
BlockWrite(OutFile,Buf,NumRecsRead)
{写4k字节进新文件}
end;
CloseFile(InFile);
CloseFile(OutFile);
end
Else
MessageDlg('Source file not exist.',mtError,[mbOk],0);
end;