Utility Routines

*INIFILE

Update INI File

Formats

1.

Read from an INI File:

CALL "*inifile;READ", [file_id$], [sect_id$], [item_id$], [default$], value$, [max_len]

2.

Write to an INI File:

CALL "*inifile;WRITE", [file_id$], sect_id$, item_id$, value$

3.

Remove an Entry from an INI File:

CALL "*inifile;REMOVE", [file_id$], sect_id$, [item_id$   OR
CALL "*inifile;DELETE", [file_id$], sect_id$, [item_id$]

Where:

 

file_id$

Path and name of the INI file to be read, created or modified. (If not specified, this defaults to pxplus.ini.)

 

sect_id$

Name of the section in the specified INI file that is to be read, created, modified or deleted. (If not specified on a READ, then all section names are returned.)

 

item_id$

Name of the item in the specified section that is to be read, created, modified or deleted. (If not specified on a READ, then all item names in the section are returned. If not specified on a REMOVE/DELETE, then all items in the section are removed.)

 

default$

Default value to be returned if the specified section and/or item does not exist in the INI file.

 

value$

On a READ, this returns the value that is read in the INI file for the specified section and/or item. On a WRITE, this is the value written to the INI file for the specified section and/or item.

 

max_len

Numeric value that contains the maximum length of the value returned via value$. (Default is 8192.)

Description

This system utility allows you to read, create and modify INI files when running on Windows and UNIX/Linux.

You can read item values, section names or the item names in a section. You can also write a new item value, and if the specified section does not exist, it is created. You can modify an existing item value, as well as remove an existing item or an entire section.

If you are writing to an INI file that does not exist, it is created by the utility using the path and filename in file_id$.

(Support for reading, writing and deleting entries when running on UNIX was added in PxPlus 2016.)

See Also

INI Files (Windows)