Talk:Using INI Files

From Free Pascal wiki
Revision as of 23:53, 24 April 2021 by Bart (talk | contribs) (Created page with "This part of the example is superfluous: <syntaxhighlight lang=pascal> ... if not FileExists(IniFile) then begin Sett := TIniFile.Create(IniFile); Sett.Upd...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This part of the example is superfluous:

...
    if not FileExists(IniFile) then begin
        Sett := TIniFile.Create(IniFile);
        Sett.UpdateFile;                // Create empty file.
        Sett.free;
    end;

You can use TIniFile.ReadXXX on a non existing file: it will return the value you supplied as "default" (it does the same for an empty file). --Bart (talk) 23:53, 24 April 2021 (CEST)