王宏健的专栏 ---- 健康快乐

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

INI文件的读写

uses inifiles;

function readInifile(fileName,section,Ident:string):string;  //读取配置文件
var
   ini:tinifile;
begin
   ini:=tinifile.Create(fileName);
   result:=ini.ReadString(section,ident,'');
   ini.Free;
end;

procedure writeInifile(const fileName,Section, Ident, Value: string); //写inifile
var
   ini:tinifile; aPathName:string;
begin
   try
       aPathName:= ExtractFileDir(fileName);
       if not DirectoryExists(aPathName) then
           ForceDirectories(aPathName);

       ini:=tinifile.Create(fileName);
       ini.WriteString(Section, Ident, Value);
       ini.Free;
   except
   end;
end;

posted on 2004-11-29 16:58  LuckyJan  阅读(244)  评论(0)    收藏  举报