zw84611进来帮个忙,谢谢。(30分)

  • 主题发起人 主题发起人 eryu
  • 开始时间 开始时间
E

eryu

Unregistered / Unconfirmed
GUEST, unregistred user!
还是刚才那个问题,我想了半天,还是不会,只有请你帮忙了。不好意思。
————————————————————————————————————
来自:zw84611, 时间:2002-11-20 21:51:00, ID:1446471
for i:= 1 to MyStrList.countdo
try
tmpStream:=TFileStream.Create('c:/windows/desktop/'+inttostr(i)+'.exe',fmCreate);
idHttp1.Get(MyStrList.Strings[i-1],tmpStream);
finally
tmpStream.Free;
end;
————————————————————————————————————
来自:eryu, 时间:2002-11-20 22:00:00, ID:1446495 | 编辑
再次感谢你。确实好用。
但和我的要求还是有点区别,主要是保存后的文件名问题。
我是想让它用默认的文件名来保存,比如MyStrList里存放了几个下载文件的路径,如:
http://www.***.com/abc/abc.exe,http://www.***.com/sdjl/ase/xyz.exe等等,我想让
它们保存后的文件名就是abc.exe和xyz.exe,如果用上面你的方法,保存后是1.exe,2.exe
这个问题应该怎么办呢?
谢谢。分不够可以再给你加。
————————————————————————————————————
来自:eryu, 时间:2002-11-20 22:01:00, ID:1446497 | 编辑
并且现在有这个警告提示:
[Warning] Unit1.pas(215): Variable 'tmpStream' might not have been initialized
但程序还可以正常运行,这提示怎么解决?
 
可以忽略,因为 create 放在 try 中。
 
function GetFileName(s: string):string;
var
i,j: integer;
begin
j:=0;
for i:= 1 to length(s)do
if s='/' then
j:=i;
delete(s,1,j);
result := s;
end;
....
for i:= 1 to MyStrList.countdo
try
tmpStream:=TFileStream.Create('c:/windows/desktop/'+GetFileName(MyStrList.Strings[i-1]),fmCreate);
idHttp1.Get(MyStrList.Strings[i-1],tmpStream);
finally
tmpStream.Free;
end;

 
接受答案了.
 
后退
顶部