读取网络文件:http://192.168.1.1/filelist.txt 是没有问题的,但是如果去逐行读取文本中的内容呢?注意:不能保存在本地后再读取.
解决方案 »
- indy的idTcpServer WriteBuffer 有内存泄露?
- ShockwaveFlash能加个onclick和mousemove事件吗
- 我用Delphi2006開發的一個初級FPS游戲,請大家下載多提保貴意見,帶引擎和游戲原碼。
- 求XP墙纸更换的一个API
- [DBNETLIB] [CONNECTION OPEN (CONNECT()).] SQL SERVER 不存在或访问被拒绝.
- 单表报表制作问题????????????????????
- 真的没人会吗?1 0 0 分求解WORD文档属性问题!
- 在设计期可以安排DBGRID里的字段显示的顺序!如何能在设计期实现此功能 ?
- 怎样把excel的格式导入Delphi中?
- 急需在delphi5下可以播放flc动画的控件
- AdvStringGrid中点cell时出现文本框,离开就没了
- 已知文件路径,如何获取程序句柄?
AssignFile(F,'http://192.168.1.1/filelist.txt');
Readln(F,..);
Programmatically Download Web Documents from the Internet
Download Files, HTML pages, RSS feeds
你也可以用 其它控件indy windows api etc.
uses WinInet; function GetInetFile (const fileURL, FileName: String): boolean;
const
BufferSize = 1024;
var
hSession, hURL: HInternet;
Buffer: array[1..BufferSize] of Byte;
BufferLen: DWORD;
f: File;
sAppName: string;
begin
result := false;
sAppName := ExtractFileName(Application.ExeName) ;
hSession := InternetOpen(PChar(sAppName), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0) ;
try
hURL := InternetOpenURL(hSession, PChar(fileURL), nil, 0, 0, 0) ;
try
AssignFile(f, FileName) ;
Rewrite(f,1) ;
repeat
InternetReadFile(hURL, @Buffer, SizeOf(Buffer), BufferLen) ;
BlockWrite(f, Buffer, BufferLen)
until BufferLen = 0;
CloseFile(f) ;
result := True;
finally
InternetCloseHandle(hURL)
end
finally
InternetCloseHandle(hSession)
end
end;
----
var
internetFile,
localFileName: string;
begin
internetFile := 'http://z.about.com/6/g/delphi/b/index.xml';
localFileName := 'About Delphi Programming RSS Feed.xml'; if GetInetFile(internetFile, localFileName) then
ShowMessage('Download successful.')
else
ShowMessage('Error in file download.') ;
function GetVersionInfo(MyURL: string): string;
var
MyIdHTTPVer: TIdHTTP;
Str: string;
begin
try
try
MyIdHTTPVer := TIdHTTP.Create(self);
Str := MyIdHTTPVer.Get(MyURL);
result := Str;
except end;
finally
MyIdHTTPVer.Free;
end;
end;
用 ftp 或者 httpserver .相当于 服务器文件名是未知的 需要设置服务器端 遍历 目录下 文件名.*
1、已经写好了用于生成服务段读取用的MD5值列表的工具(更新的文件比较多);
2、现在读取网络文件就是用的TIdhttp控件,就差逐行读取MD5值的方法;请大虾们指教
begin
sl:=TStringList.Create;
sl.LoadFromFile('md5.txt');
ShowMessage(sl[0]);
sl.Free;
end;
var
i:Integer;
sl:TStringList;
begin
sl:=TStringList.Create;
sl.Text:=( IdHTTP1.Get('http://127.0.0.1/1.txt'));
for I := 0 to sl.Count - 1 do
ShowMessage(sl[i]);
sl.Free
end.