进度复制用哪种方法速度最快,最不容易出错?请给个例子,谢谢
解决方案 »
- 请教关于dbgrideh 不同值颜色不同的问题
- delphi多线程调用webservice的问题,非常着急。
- 系统服务的关于ini配置文件的创建问题
- 对于已经注册的类,如何才能取消掉呢
- Delphi和VB的数据类型问题.急!
- 怎么样能按一个按钮,使decisiongraph1的图形变化样式,如由柱形变成饼形?
- 怎样设置激发ontimer的时间间隔?
- 为什么delphi的ado到了windows98下面运行就出错?请帮忙,急!!
- 各位高手,由于本人没搞过WEB的开发,现在有一个项目要作成基于WEB的,而且还要涉及到很多图形的处理,能否实现我不能确定,望大家给个主意
- 请问一下C编的程序如何转换成Delphi
- delphi2010 中StrToFloat 出错 (AnsiString怎么转浮点型)?
- 求一条SQL语句?
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
{var
f,df:file;
tf,td,count:integer;
but:array[1..2048]of char;
m,m1:boolean;}
var
treadf,twritef:file;
tinfof:textfile;
numr,numw:integer;
buf:array[1..2048]of char;
path,fname,exfname:string;
begin
path:='i:\'; if fileexists(edit1.Text)then
begin
assignfile(tinfof,edit1.Text);
reset(tinfof);
readln(tinfof,fname);
exfname:=extractfilename(fname); //获取文件名,并加入“合并后的”这个特定标志;
exfname:='合并后的'+copy(exfname,0,length(exfname)-1);
closefile(tinfof); assignfile(tinfof,edit1.Text); //重新打开配置文件
reset(tinfof);
end; assignfile(twritef,edit2.Text); //打开要写入的文件
rewrite(twritef,1);
while not eof(tinfof)do //循环读取配置文件中的信息,即文件名;
begin
readln(tinfof,fname);
showmessage(path+fname);
if fileexists(path+fname) then
begin
assignfile(treadf,path+fname);
reset(treadf,1);
while not eof(treadf) do //从文件块中读数据,如果没有到文件尾,就循环读,直到把当前文件块读完
begin
blockread(treadf,buf,sizeof(buf),numr);
blockwrite(twritef,buf,numr,numw);
end;
end;
end;
closefile(tinfof);
closefile(twritef);
closefile(treadf);
showmessage('successfully!'); end;procedure TForm1.Button2Click(Sender: TObject);
var
treadf,twritef:file;
buf:array[1..2048]of char;
numr,numw,count,co:integer;
path,fname:string;
begin
path:='e:\';
fname:='ss.mpeg';
count:=0;
co:=0;
try
assignfile(treadf,path+fname);
reset(treadf,1);
assignfile(twritef,'i:\a.mpeg');
rewrite(twritef,1);
while not eof(treadf) do //如果没有到文件尾就一直读
begin
inc(count);
blockread(treadf,buf,sizeof(buf),numr);
if (count*2 div 1024)=10 then
begin
inc(co);
closefile(twritef); //如果文件块为用户自定义的大小时,就关闭文件,重新再生成一个文件;
assignfile(twritef,'i:\a'+inttostr(co)+'.mpeg');
rewrite(twritef,1);
blockwrite(twritef,buf,numr,numw);
count:=0;
end
else
begin
blockwrite(twritef,buf,numr,numw);
end;
end;
finally
closefile(treadf);
closefile(twritef);
end;
showmessage('successfully!');
end;procedure TForm1.Button3Click(Sender: TObject);
begin
showmessage(extractfilename('i:\a.mpeg'));
end;end.