INISectionExists

From SCAR Divi Manual
Revision as of 12:31, 1 July 2011 by Freddy (talk | contribs) (Undo revision 502 by Freddy (talk))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Definition

function INISectionExists(const Section, FileName: string): Boolean;

Availability

SCAR Divi 3.25 > Current

Description

Returns true if a section specified by Section in an INI file specified by FileName exists. If the file does not exist, the function returns false as well. When FileName contains an invalid file path, an exception is thrown and the script is stopped.

Example

begin
  WriteLn(INISectionExists('Section', LogsPath + 'Test.ini'));
  WriteINI('Section', 'Key', 'Hello World!', LogsPath + 'Test.ini');
  WriteLn(INISectionExists('Section', LogsPath + 'Test.ini'));

  DeleteFile(LogsPath + 'Test.ini');
end.

Output:

0
1

See Also