上一篇 | 下一篇

读INI文件

发布: 2008-6-26 20:32 | 作者: admin | 来源: | 查看: 0次

width="84%">读INI文件

function GetINIfile(lpAppNameL,lpKeyName,lpDefault:string;

lpsize:integer;lpFileName:string):string;

{读取ini文件函数}

var f:textfile;

sn:string;

begin

assignfile(f,lpFileName);

reset(f);

repeat

readln(f,sn);

if sn='['+lpAppNameL+']' then

begin

readln(f,sn);

while(copy(sn,1,1)<>'[')or(not(eof(f)))do

begin

if copy(sn,1,pos('=',sn)-1)=lpKeyName then

begin

GetINIfile:=copy(sn,pos('=',sn)+1,lpsize);

exit;

end;

readln(f,sn);

end;

end

else GetINIfile:=lpDefault;

until eof(f);

closefile(f);

end;

{------------}

Timeout:=GetINIfile('MailSetup','Timeout','0',5,prgpath+'\CNMSet.ini');

字号: | 推荐给好友

评分:0

我来说两句