Difference between revisions of "INISectionExists"
From SCAR Divi Manual
(→See Also) |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
==Definition== | ==Definition== | ||
<source lang="scar" lines="false"> | <source lang="scar" lines="false"> | ||
− | function | + | function INISectionExists(const Section, FileName: string): Boolean; |
</source> | </source> | ||
Line 8: | Line 8: | ||
==Description== | ==Description== | ||
− | Returns [[true]] if | + | Returns [[true]] if a section specified by '''Section''' in an [http://en.wikipedia.org/wiki/INI_file 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== | ==Example== | ||
<source lang="scar"> | <source lang="scar"> | ||
begin | begin | ||
− | WriteLn( | + | WriteLn(INISectionExists('Section', LogsPath + 'Test.ini')); |
WriteINI('Section', 'Key', 'Hello World!', LogsPath + 'Test.ini'); | WriteINI('Section', 'Key', 'Hello World!', LogsPath + 'Test.ini'); | ||
− | WriteLn( | + | WriteLn(INISectionExists('Section', LogsPath + 'Test.ini')); |
DeleteFile(LogsPath + 'Test.ini'); | DeleteFile(LogsPath + 'Test.ini'); | ||
Line 27: | Line 27: | ||
==See Also== | ==See Also== | ||
*[[INIKeyExists]] | *[[INIKeyExists]] | ||
+ | *[[GetINISections]] | ||
*[[ReadINI]] | *[[ReadINI]] | ||
*[[DeleteINI]] | *[[DeleteINI]] |
Latest revision as of 12:31, 1 July 2011
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