用到的单元IniFiles;
function ReadIni(filename, Section, ident, sdefault: string): string;
vartmpIni: TIniFile;
begin
try
tmpIni := TIniFile.Create(filename);
Result := tmpIni.ReadString(Section, ident, sdefault);
finally
FreeAndNil(tmpIni);
end;
end;
procedure WriteIni(filename, Section, ident, svalue: string);
var
tmpIni: TIniFile;
begin
try
tmpIni := TIniFile.Create(filename);
tmpIni.WriteString(Section, ident, svalue);
finally
FreeAndNil(tmpIni);
end;
end;
本文介绍了一种在Delphi中读取和写入INI文件的方法。通过定义两个过程:ReadIni用于从指定的INI文件中读取字符串值,WriteIni用于将字符串值写入INI文件。这两个过程使用了TIniFile组件来实现对INI文件的操作。
404

被折叠的 条评论
为什么被折叠?



