Difference between revisions of "Talk:Using INI Files"

From Lazarus wiki
Jump to navigationJump to search
(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...")
 
(thanks Bart)
Line 9: Line 9:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
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). --[[User:Bart|Bart]] ([[User talk:Bart|talk]]) 23:53, 24 April 2021 (CEST)
 
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). --[[User:Bart|Bart]] ([[User talk:Bart|talk]]) 23:53, 24 April 2021 (CEST)
 +
 +
OK, I have in my notes not to do that but I cannot demonstrate it leading to problems now ! So I don't know where I got that idea from.  I will remove that section, thanks Bart.
 +
--[[User:Dbannon|Dbannon]] ([[User talk:Dbannon|talk]]) 02:24, 25 April 2021 (CEST)

Revision as of 02:24, 25 April 2021

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)

OK, I have in my notes not to do that but I cannot demonstrate it leading to problems now ! So I don't know where I got that idea from. I will remove that section, thanks Bart. --Dbannon (talk) 02:24, 25 April 2021 (CEST)