TIniFile.SetStrings

From Soldat Community Wiki
Revision as of 02:28, 23 August 2013 by Mighty (talk | contribs) (new page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
procedure SetStrings(List: TStrings)
 List: Strings that are supposed to be converted

Description

This procedure builds TIniFIle from List.
It doesn't add to existing lines, it completely rebuilds TIniFIle.
Doesn't update the file though.

Example

var

 l: TStringList;
 ini: TIniFile;
 i: integer;

begin

 l := File.CreateStringList();
 // assuming Sandbox Level < 2
 l.Append('[Section10]');
 l.Append('Key1=3');
 
 ini := File.CreateINI('example.ini');
 
 ini.SetStrings(l);
 WriteLn(ini.ReadString('Section10','Key1','ERROR')); // 3 will be displayed
 
 l.Free;
 ini.Free;

end. </syntaxhighlight>