ReadINI

From SCAR Divi Manual
Jump to: navigation, search

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