Difference between revisions of "TIniFile.WriteBool"

From Soldat Community Wiki
Jump to: navigation, search
(new page)
 
m (Example)
 
Line 20: Line 20:
 
begin
 
begin
 
   Ini := File.CreateINI(PATH);
 
   Ini := File.CreateINI(PATH);
   Ini.WriteInteger('BOTS','ImStupid',TRUE);
+
   Ini.WriteBool('BOTS','ImStupid',TRUE);
 
   Ini.UpdateFile;
 
   Ini.UpdateFile;
 
   Ini.Free;
 
   Ini.Free;

Latest revision as of 01:45, 23 August 2013

procedure WriteBool(const Section, Ident: String; Value: Boolean)
 Section: Section name
 Ident: Property name (key)
 Value: Value to be assigned to a key

Description

This procedure updates an existing key's value or creates a new one.
Note that boolean values are stored as 1 (TRUE) and 0 (FALSE)

Example

Example adds a new (useless) key to soldat.ini

const
  // assuming Sandbox Level < 2
  PATH = 'soldat.ini';

var
  Ini: TIniFile;

begin
  Ini := File.CreateINI(PATH);
  Ini.WriteBool('BOTS','ImStupid',TRUE);
  Ini.UpdateFile;
  Ini.Free;
end.