我今天又试了下:把制作索引的部分注释掉,合成比较顺利,但是不注释掉的话合不了多少,我晕,检查了函数和合成少一点的文件倒还可以符合要求,我晕
rocedure TForm1.Button5Click(Sender: TObject);
type
sy=record
nm:string;
n:longint;
end;
var i,j,k:integer;
kk:longint;
kill:array of sy;
ss:string;
tf1,tf2,tf3,tf4:tstream;
str1:tstrings;
begin
if listbox1.Items.Count>0 then
begin
if savedialog1.Execute then
try
screen.Cursor:=crHourGlass;
str1:=tstringlist.Create;
setlength(kill,listbox1.Items.Count);
tf1:=tfilestream.Create(savedialog1.FileName,fmCreate);
ss:='';
for j:=1 to 2048 do
begin
ss:=ss+'$';
end;
str1.Text:=ss;
str1.SaveToFile('jill.txt');
tf2:=tfilestream.Create('jill.txt',fmopenread);
str1.Clear;
gauge1.MaxValue:=listbox1.Items.Count-1;
for i:=0 to listbox1.Items.Count-1 do
begin
tf2.Position:=0;
application.ProcessMessages;
tf3:=tfilestream.Create(listbox1.Items.Strings
,fmOpenread);
kill.nm:=extractfilename(listbox1.Items.Strings);
kill.n:=tf3.Size;
tf1.CopyFrom(tf3,tf3.Size);
if (tf3.Size mod 2048)<>0 then
begin
tf1.CopyFrom(tf2,(2048-(tf3.Size mod 2048)));
end;
gauge1.Progress:=i;
end;
{ ss:=''
//注释掉的 这难道是问题所在吐血
for k:=1 to 1048575 do
begin
kk:=2048*k;
for j:=low(kill) to high(kill) do
begin
ss:=ss+kill[j].nm+':'+inttostr(kk)+':'+inttostr(kill[j].n)+';';
if (kill[j].n mod 2048)<>0 then
begin
kk:=kk+2048*((kill[j].n div 2048) +1);
end
else begin
kk:=kk+kill[j].n
end;
end;
if k*2048>=length(ss) then break;
end;
ss:=trim(ss);
if (length(ss) mod 2048)<>0 then
begin
for j:=1 to (2048-(length(ss) mod 2048)) do
ss:=ss+'$';
end;
str1.Text:=ss;
tf1.Position:=0;
str1.SaveToStream(tf1)
}
gauge1.Progress:=0;
finally
tf1.Free;
tf2.Free;
tf3.Free;
deletefile('jill.txt');
screen.Cursor:=crDefault;
end;
end;
end;