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

PutINIString

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

Syntax

PutINIString (Context, Group, Option, Default)

Parameter

Description

Context

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

 

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

Option

Enter the name of the option into which you want the INI string variable stored. If the control group and option does not exist, the system creates them.

Default

(Optional) Enter the default string value you want to store in the control group and option string variable. The default is Null.

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

This procedure stores a string value into the specified control group and option string variable. If the context name is not present and the control group and option does not exist in any of the INI sets, the procedure stores the string variable into the FSIUSER.INI file.

If there are multiple control groups and options of the same name, the procedure stores the string 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 string value in the control group and option variable associated with the context name.

Example

Let’s assume that an INI file, TEST1.INI, was loaded with the context name, MVF. The TEST1.INI file contains this control group and option:

< Control >
 title = MVF’s string

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

< Control >
  Title = Bob’s string

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

< Control >
  Title = fap entry

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

Procedure

Result

Explanation

rc = PutINIString

(,"Control", "Title");

The string variable Title in the FSIUSER.INI file now contains Bob’s string. 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 = PutINIString

("MVF", "Control", "Title");

The string variable Title in the TEST1.INI file now contains MVF’s string. The return code rc will be set to one (1).

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

rc = PutINIString ("MVF", "Control", "Title", "New string");

The string variable Title in the TEST1.INI file now contains New string. If Control and Title are not found, the system creates them and sets the string variable Title to New string.

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

Example