急!!关于下载的问题!!急! (20分)

E

eryu

Unregistered / Unconfirmed
GUEST, unregistred user!
MyStrList: TStringList;
我的下载文件路径保存在MyStrList里面,我想通过以下语句下载,
idHttp1.Get(MyStrList,tmpStream);
但编译时出错:
[Error] Unit1.pas(213): There is no overloaded version of 'Get' that can be called with these arguments
好像是因为MyStrList不是string类型的,怎样解决这个问题呢?
谢谢!
在线等待!
 
for i:= 1 to MyStringList.countdo
idHttp1.Get(MyStrList.Strings[i-1],tempStream);
 
谢谢你,顺便再问个问题。
以下是我的代码:
tmpStream:=TFileStream.Create('c:/windows/desktop/1.exe',fmCreate);
try
for i:= 1 to MyStrList.countdo
idHttp1.Get(MyStrList.Strings[i-1],tmpStream);
finally
tmpStream.Free;
end;
因为MyStrList里面有多个要下载的文件路径,但我上面那句只能把下载的文件保存为
c:/windows/desktop/1.exe,这样到最后只有一个文件,我想让它们一个个自动地下,
下载后的文件名就用它们本身默认的,这个应该怎样做呢?
谢谢你了。
 
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;
 
再次感谢你。确实好用。
但和我的要求还是有点区别,主要是保存后的文件名问题。
我是想让它用默认的文件名来保存,比如MyStrList里存放了几个下载文件的路径,如:
http://www.***.com/abc/abc.exe,http://www.***.com/sdjl/ase/xyz.exe等等,我想让
它们保存后的文件名就是abc.exe和xyz.exe,如果用上面你的方法,保存后是1.exe,2.exe
这个问题应该怎么办呢?
谢谢。分不够可以再给你加。
 
并且现在有这个警告提示:
[Warning] Unit1.pas(215): Variable 'tmpStream' might not have been initialized
但程序还可以正常运行,这提示怎么解决?
 
其实都是很简单的,你该自己思考一下。你现在要做的只是从字符串
“http://www.***.com/abc/abc.exe”中提取出文件名,你应该能自己解决吧[:)]
 
接受答案了.
 

Similar threads

顶部