function tform1.addtofile(sourcefile,targetfile:string):boolean;
var
target,source:tfilestream;
myfilesize:integer;
begin
try
source:=tfilestream.Create(sourcefile,fmopenread or fmshareexclusive);
target:=tfilestream.Create(targetfile,fmopenwrite or fmshareexclusive);
try
target.Seek(0,sofromend);
target.CopyFrom(source,0);
myfilesize:=source.Size+sizeof(myfilesize);
target.WriteBuffer(myfilesize,sizeof(myfilesize));
finally
target.Free;
source.Free;
end;
except
result:=false;
exit;
end;
result:=true;
end;
我在BUTTON的CLICK事件调用此涵数
if(addtofile('d:\111\project1.exe','d:\444\project1.exe')) then
showmessage('yes')
else
showmessage('no');
结果提示对话框‘YES’,我想问我怎样查找到添加'd:\444\project1.exe'此文件的'd:\111\project1.exe'的内容呀急呀
var
target,source:tfilestream;
myfilesize:integer;
begin
try
source:=tfilestream.Create(sourcefile,fmopenread or fmshareexclusive);
target:=tfilestream.Create(targetfile,fmopenwrite or fmshareexclusive);
try
target.Seek(0,sofromend);
target.CopyFrom(source,0);
myfilesize:=source.Size+sizeof(myfilesize);
target.WriteBuffer(myfilesize,sizeof(myfilesize));
finally
target.Free;
source.Free;
end;
except
result:=false;
exit;
end;
result:=true;
end;
我在BUTTON的CLICK事件调用此涵数
if(addtofile('d:\111\project1.exe','d:\444\project1.exe')) then
showmessage('yes')
else
showmessage('no');
结果提示对话框‘YES’,我想问我怎样查找到添加'd:\444\project1.exe'此文件的'd:\111\project1.exe'的内容呀急呀
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货