procedure Tmain_form.CopyFile(Sender: Tobject;Const InFile,OutFile : TFileName;sw : Boolean);
begin
AssignFile(FromF,InFile);
Reset(FromF,1);
AssignFile(ToF,OutFile);
ReWrite(ToF,1);
for_ii :=0;
Repeat
BlockRead(FromF,buf,SizeOf(Buf),NumRead);
if (for_ii = 0) and sw then
begin
Str_temp := OutFile;
while Pos('/',Str_temp)<>0 do
Str_temp := Copy(Str_temp,Pos('/',Str_temp)+1,Length(Str_temp)-Pos('/',Str_temp));
for for_ii := 1 to Length(Str_temp)-4 do
buf[4+for_ii]:=Str_temp[for_ii];
buf[5+for_ii]:=#0;
for_ii :=1;
end;
BlockWrite(ToF,buf,NumRead,NumWrite);
until (NumRead=0) or (NumWrite<>NumRead);
System.CloseFile(FromF);
System.CloseFile(ToF);
end;
本COPY函数还支持DBASE数据库的MDX拷贝,SW=TRUE;