Difference between revisions of "INISectionExists"

From SCAR Divi Manual
Jump to: navigation, search
(Undo revision 502 by Freddy (talk))
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Definition==
 
==Definition==
 
<source lang="scar" lines="false">
 
<source lang="scar" lines="false">
function INIKeyExists(const Section, KeyName, FileName: string): Boolean;
+
function INISectionExists(const Section, FileName: string): Boolean;
 
</source>
 
</source>
  
Line 8: Line 8:
  
 
==Description==
 
==Description==
Returns [[true]] if a key specified by '''KeyName''' in 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.
+
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(INIKeyExists('Section', 'Key', LogsPath + 'Test.ini'));
+
   WriteLn(INISectionExists('Section', LogsPath + 'Test.ini'));
 
   WriteINI('Section', 'Key', 'Hello World!', LogsPath + 'Test.ini');
 
   WriteINI('Section', 'Key', 'Hello World!', LogsPath + 'Test.ini');
   WriteLn(INIKeyExists('Section', 'Key', LogsPath + 'Test.ini'));
+
   WriteLn(INISectionExists('Section', LogsPath + 'Test.ini'));
  
 
   DeleteFile(LogsPath + 'Test.ini');
 
   DeleteFile(LogsPath + 'Test.ini');
Line 26: Line 26:
  
 
==See Also==
 
==See Also==
*[[INISectionExists]]
+
*[[INIKeyExists]]
 +
*[[GetINISections]]
 
*[[ReadINI]]
 
*[[ReadINI]]
 
*[[DeleteINI]]
 
*[[DeleteINI]]

Latest revision as of 13: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

See Also