实现高速文件拷贝_Delphi
program FastCopy;
{$A+,B-,D-,E+,F+,G+,I-,L-,N+,P-,Q-,R-,S-,T-,V-,X-,Y-}
{$M 16384,$10000}
const
MaxBufCnt = 1000;
type
BufPtr = ^BufRec;
BufRec = array[0..8190] of byte;
http://www.gaodaima.com/65601.html实现高速文件拷贝_Delphi
var
InFile, OutFile : file; {IF is In File, OF is OutFile}
Buffer : array[1..MaxBufCnt] of BufPtr;
BufLen : array[1..MaxBufCnt] of word;
BufSiz : array[1..MaxBufCnt] of word;
BufCnt : byte;
Total : longint;
SizeofFile : longint;
IndexR,IndexW : byte;
BytesWritten : word;
BR, BW : longint;
Timer1,Timer2 : longint;
Ticks : ^Longint;
begin
Ticks := Ptr(Seg0040, $006c);
if paramcount < 2 then begin
writeln('Usage:', paramstr(0), '
');
halt;
end;
assign(InFile, paramstr(1));
assign(OutFile, paramstr(2));
writeln;
writeln('Copying ', paramstr(1), ' to ', paramstr(2));
reset(InFile, 1);
rewrite(OutFile, 1);
BufCnt := 0;
SizeOfFile := filesize(InFile);
Total := 0;
while (MaxAvail>8192) and (BufCnt
BufLen[IndexW] then begin
writeln;
writeln('Error writing to file... Disk might be full');
Halt;
end;
end;
end;
Close(InFile);
Close(OutFile);
Timer2 := ticks^;
writeln;
writeln('Copy took ', Timer2-Timer1, ' timer ticks to complete');
writeln('Throughput is ', SizeOfFile div (Timer2-Timer1), ' bytes/tick');
writeln('or if you prefer ', (SizeOfFile div (Timer2-Timer1)) * 18.2:8:0, '
bytes/second'); for IndexR := 1 to BufCnt do
freemem(Buffer[IndexR], BufSiz[IndexR]);
writeln;
writeln('Copy complete');
end.
欢迎大家阅读《实现高速文件拷贝_Delphi》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码
原创文章,转载请注明: 转载自搞代码
本文链接地址: 实现高速文件拷贝_Delphi

微信 赏一包辣条吧~

支付宝 赏一听可乐吧~
发表评论