[delphi]代码库
//读写程序根目录下的CONFIG.INI文件
uses IniFiles;
//读取ini
function Readini(Section, key: string): string;
var
temp: Tinifile;
begin
temp := Tinifile.create(extractfilepath(application.ExeName) + 'CONFIG.INI');
try
Readini := temp.ReadString(section, key, '');
finally
temp.Free;
end;
end;
//写入ini
procedure Writeini(Section, key, value: string);
var
temp: Tinifile;
begin
temp := Tinifile.Create(extractfilepath(application.exename) + 'CONFIG.INI');
try
temp.WriteString(Section, key, value);
finally
temp.Free;
end;
end;