Difference between revisions of "ReadINI"
From SCAR Divi Manual
(→Description) |
|||
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, it will also do this if the file specified by '''FileName''' does not exist. | + | 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!