急求‘文件分割’的原码!谢谢!!! 急求‘文件分割’的原码!谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我这里有一个,给你:var treadf,twritef:file; tinfof:textfile; path,fname,exfile,filename:string; buf:array[1..1024]of char; numr,numw,fco,count,blocksize:integer; tfm:tfilestream;begin try count:=0; //blockread读的次数,用以计算产生文件块的大小 fco:=1; //分成的块数 path:=getcurrentdir()+'\'; fname:=form1.FileListBox1.FileName; tfm:=tfilestream.Create(fname,fmopenread); //得到文件的大小 blocksize:= tfm.Size div (1024*1024*2); count2:=tfm.Size div (1024*2); //获得文件有多少个2M tfm.Free; exfile:=extractfilename(fname); //得到要分割文件名及扩展名 filename:=getfilename(fname); //得到分割文件名,不含扩展名 assignfile(treadf,fname); //打开要分割的文件 reset(treadf,1); assignfile(twritef,path+exfile+'1');//关联要写入的文件并打开 rewrite(twritef,1); assignfile(tinfof,path+filename+'.lpkit'); //为写入配置文件准备 rewrite(tinfof); writeln(tinfof,exfile+'1'); //向配置文件中写入第一个文件名 screen.Cursor:=crappstart; //设置鼠标的状态 //form1.Cursor:=crappstart; synchronize(setv); //设置文件的进度条 while not eof(treadf)do begin inc(count); blockread(treadf,buf,sizeof(buf),numr); if (count div 1100)>=blocksize then begin closefile(twritef); //如果文件块为用户自定义的大小时,就关闭文件,重新再生成一个文件; inc(fco); writeln(tinfof,exfile+inttostr(fco)); //向配置文件中写入文件名 assignfile(twritef,path+exfile+inttostr(fco)); //重新生成一个新的文件块 rewrite(twritef,1); blockwrite(twritef,buf,numr,numw); count:=0; synchronize(setstep);//设置文件的标准步进setstep; end else begin blockwrite(twritef,buf,numr,numw); synchronize(setstep);//设置文件的标准步进setstep; end; end; closefile(treadf); closefile(twritef); closefile(tinfof); screen.Cursor:=crdefault; //form1.Cursor:=crdefault; messagebox(form1.Handle,pchar('分割了:'+inttostr(fco)+'块'+#13+'请到目录:"'+path+'"下去查看!'),'提示',mb_ok or mb_iconinformation); synchronize(setvv); //置为初始态 shellexecute(form1.Handle,'open',pchar(path),'-s','',sw_shownormal); except try screen.Cursor:=crdefault; synchronize(setvv); closefile(treadf); closefile(twritef); closefile(tinfof); except messagebox(form1.Handle,pchar('读取文件出错,请重新选择要分割的文件!'),'警告',mb_ok or mb_iconwarning); end; end; end; 求宝宝名字 二进制图片存储 如何获得客户端端口好?? 大哥们帮忙看看这段代码 怎样才能使mainmenu控件生成的菜单字体变大 请教右键功能的实现(复制,粘贴,剪切,刷新)? 对话框(dialog)的格式(数据结构) Intraweb开发问题 : Intraweb系统支持的系统怎样加入第二个窗口并可使用? csdn得页面需要修改,不然还是不适合以Ip的方式进入 怎样实现智能分段? 问个关于生成注册码时,获得CPU ID的问题 请对MIDAS真正了解的朋友进来看几个问题
treadf,twritef:file;
tinfof:textfile;
path,fname,exfile,filename:string;
buf:array[1..1024]of char;
numr,numw,fco,count,blocksize:integer;
tfm:tfilestream;
begin
try
count:=0; //blockread读的次数,用以计算产生文件块的大小
fco:=1; //分成的块数
path:=getcurrentdir()+'\';
fname:=form1.FileListBox1.FileName;
tfm:=tfilestream.Create(fname,fmopenread); //得到文件的大小
blocksize:= tfm.Size div (1024*1024*2);
count2:=tfm.Size div (1024*2); //获得文件有多少个2M
tfm.Free; exfile:=extractfilename(fname); //得到要分割文件名及扩展名
filename:=getfilename(fname); //得到分割文件名,不含扩展名 assignfile(treadf,fname); //打开要分割的文件
reset(treadf,1);
assignfile(twritef,path+exfile+'1');//关联要写入的文件并打开
rewrite(twritef,1); assignfile(tinfof,path+filename+'.lpkit'); //为写入配置文件准备
rewrite(tinfof);
writeln(tinfof,exfile+'1'); //向配置文件中写入第一个文件名 screen.Cursor:=crappstart; //设置鼠标的状态
//form1.Cursor:=crappstart; synchronize(setv); //设置文件的进度条 while not eof(treadf)do
begin
inc(count);
blockread(treadf,buf,sizeof(buf),numr);
if (count div 1100)>=blocksize then
begin
closefile(twritef); //如果文件块为用户自定义的大小时,就关闭文件,重新再生成一个文件;
inc(fco);
writeln(tinfof,exfile+inttostr(fco)); //向配置文件中写入文件名
assignfile(twritef,path+exfile+inttostr(fco)); //重新生成一个新的文件块
rewrite(twritef,1);
blockwrite(twritef,buf,numr,numw);
count:=0; synchronize(setstep);//设置文件的标准步进setstep; end
else
begin
blockwrite(twritef,buf,numr,numw);
synchronize(setstep);//设置文件的标准步进setstep;
end;
end;
closefile(treadf);
closefile(twritef);
closefile(tinfof);
screen.Cursor:=crdefault;
//form1.Cursor:=crdefault;
messagebox(form1.Handle,pchar('分割了:'+inttostr(fco)+'块'+#13+'请到目录:"'+path+'"下去查看!'),'提示',mb_ok or mb_iconinformation); synchronize(setvv); //置为初始态 shellexecute(form1.Handle,'open',pchar(path),'-s','',sw_shownormal);
except
try
screen.Cursor:=crdefault;
synchronize(setvv);
closefile(treadf);
closefile(twritef);
closefile(tinfof);
except
messagebox(form1.Handle,pchar('读取文件出错,请重新选择要分割的文件!'),'警告',mb_ok or mb_iconwarning);
end;
end;
end;