Difference between revisions of "ReadINI"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function ReadINI(Section, KeyName, FileName: string): string; </source> ==Availability== SCAR Divi 3.00 > Current ==Descriptio...")
 
 
(One intermediate revision by the same user not shown)
Line 8: Line 8:
  
 
==Description==
 
==Description==
Reads data from a file with an [http://en.wikipedia.org/wiki/INI_file INI] structure specified by the path '''FileName'''. It reads the value of the key specified by '''KeyName''' in the section specified by '''Section'''. If the '''Section''' or '''KeyName''' are empty it will return an empty string. If '''FileName''' contains an invalid file path, it will error and stop the script. If the file specified by '''FileName''' does not exist, it will return an empty string as well.
+
Reads data from a file with an [http://en.wikipedia.org/wiki/INI_file INI] structure specified by the path '''FileName'''. It reads the value of the key specified by '''KeyName''' in the section specified by '''Section'''. If the '''Section''' or '''KeyName''' are empty it will return an empty string, it will also do this if the file specified by '''FileName''' does not exist. When '''FileName''' contains an invalid file path, an exception is thrown and the script is stopped.
  
 
===File structure===
 
===File structure===

Latest revision as of 12:01, 1 July 2011

Definition

function ReadINI(Section, KeyName, FileName: string): string;

Availability

SCAR Divi 3.00 > Current

Description

Reads data from a file with an INI structure specified by the path FileName. It reads the value of the key specified by KeyName in the section specified by Section. If the Section or KeyName are empty it will return an empty string, it will also do this if the file specified by FileName does not exist. When FileName contains an invalid file path, an exception is thrown and the script is stopped.

File structure

[Section]
Key=Value

Example

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

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

Output:

Hello World!

See Also