First, INI structure of the file:
; Comments
[section name]
Keyword = value
INI file has several subsections, each with more than one keyword, and "=" followed by the value of the keyword.
There are three types of values: String, Integer value, and Boolean value.
Where strings are stored in the INI file without quotation marks,
Boolean true value is represented by 1, and Boolean false values are expressed in 0.
Comment with a semicolon ";" Beginning.
Second, the definition
1, the uses festival in interface increased inifiles;
2, add a line in the var variable definition section: myinifile:tinifile;
The variable myinifile can then be created, opened, read, written, and so on.
Third, open INI file
Filename:=extractfilepath (Paramstr (0)) + 'program. Ini '; myinifile:=tinifile. Create (filename);
Iv. reading the value of a keyword
The Tinifiles class provides three different object methods to read the values of the keywords in the INI file for the string, integer numeric, and Boolean three data types supported by the INI file.
// String Type VI: // integer Type vb:=myinifile. Readbool (' Bar name ', ' keyword ', default value); // Boolean type
V. Write INI file
// String Type //integer class //Boolean type
When this INI file does not exist, the above statement will also automatically create the INI file.
Vi. deletion of Keywords
Myinifile. DeleteKey (' Bar name ', ' keywords ');
Seven, subsection operation
Add a section that can be written to the method to complete, delete a section using the following object method: Myinifile. Erasesection (' subsection name '), and the Tinifile class also provides three object methods to manipulate the subsections:
Myinifile.readsection (' Bar name ', tstrings variable);
All key names in the specified section can be read into a string list variable;
Myinifile.readsections (tstrings variable);
All the subsection names in the INI file can be read into a string list variable.
Myinifile.readsectionvalues (' Bar name ', tstrings variable);
You can read all the lines (including keywords, =, values) in the specified section of the INI file into a string list variable.
Viii. Release
In the appropriate location, release myinifile with the following statement:
Myinifile.distory;
Manipulating INI Files