You are here: Function Reference > Alphabetical Listing > P > PutINIBool

PutINIBool

Use this procedure/function to store a Boolean value in an INI control group and option Boolean variable.

Syntax

PutINIBool (Context, Group, Option, Default)

Parameter

Description

Context

(Optional) Enter the name (valid string) associated with a set of INI control groups and options loaded into cache memory.

Group

Enter the name of the control group which contains the INI option Boolean variable.

Option

Enter the name of the option in which the INI Boolean variable will be stored. If the control group and option does not exist, the system creates them.

Default

(Optional) Enter the default Boolean value to store into the control group and option Boolean variable. The default is zero (0).

The system returns one (1) if no error occurred during execution and zero (0) if there was an error.

This procedure stores a Boolean value in the specified control group and option Boolean variable.

If you omit context name and the control group and option does not exist in any of the INI files, the procedure stores the Boolean value in the FSIUSER.INI file.

If there are multiple control groups and options with the same name, the procedure stores the Boolean value in the first INI control group and option variable equal to the specified control group and option name.

If a context name is present, the procedure only stores the Boolean value in the control group and option variable associated with the context name.

Example

Assume an INI file, TEST1.INI, was loaded with the context name, MVF. The TEST1.INI file contains this control group and option:

< Control >
  LogEnabled = 1

In addition, the FSIUSER.INI file contains this control group and option:

< Control >
  LogEnabled = 0

Plus, the FSISYS.INI file contains this control group and option:

< Control >
  LogEnabled = 1

Based on this scenario, the following table shows and explains several possible results.

Procedure

Result

Explanation

rc = PutINIBool

(,"control", "LogEnabled");

The variable bool_value in the FSIUSER.INI file now contains a zero (0). The return code rc is set to one (1).

The procedure scanned the loaded INI control groups and options. It found the specified control group and option in the FSIUSER.INI first. The FSIUSER.INI set is searched first, followed by the FSISYS.INI set and then any other loaded sets, in order.

rc = PutINIBool

("MVF", "control", "LogEnabled");

The variable bool_value in the TEST1.INI file now contains a zero (0). The return code rc is set to one (1).

The procedure scans only the control group and option set associated with the context name MVF.

rc = PutINIBool ("MVF", "control", "LogEnabled", 1);

The variable bool_value in the TEST1.INI file now contains a one (1). If Control and LogEnabled are not found, the system creates a control group and option and sets the Boolean variable LogEnabled to one (1).

The procedure scans only the control group and option set associated with the context name MVF.

See also