TIniFile.Clear

From Soldat Community Wiki
Revision as of 02:17, 23 August 2013 by Mighty (talk | contribs) (new page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
procedure Clear();

Description

This procedure deletes all entries in a TIniFile, including empty and commented lines.

Example

example.ini in soldatserver's root folder:

[Section1]
Key1=1
Key2=

actual script code:

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

begin
  l := File.CreateStringList();
  // assuming Sandbox Level < 2
  ini := File.CreateINI('example.ini');
  ini.Clear;
  
  ini.GetStrings(l);
  for i:=0 to l.Count-1 do
    WriteLn('>> '+l[i]); // nothing will be displayed since it's all gone
  
  l.Free;
  ini.Free;
end.