Clarion ProScan Help

INI File Method

INI File Method

Previous topic Next topic  

INI File Method

Previous topic Next topic  

If you are using the INI file storage method, here are examples of how to use the class.

 

Remember that the global extension template takes care of the initialization process for you, but you can also reinitialize on the fly to use a different file or key.

 

Hint:  Once initialized, the class will use whatever INI file you have specified until you reinitialize it with a new value.

 

Here is an example of a hand coded initialization for an INI file:

 

 DATA

 

RIC        RegINIClass

 

 CODE

 

 RIC.Init( 'INIFile', 'Myfile.ini' )

 

In the Init, the INIFile string tells the class to use the INI file method of storage.

 

This example would initialize the class to the INI file mode of storage and to use a file called 'Myfile.ini'.

 

 

Writing and reading data from the file takes the same syntax as you are used to with the standard Clarion GetINI and PutINI statements - except that the last parameter (the filename) is optional (and totally ignored by the RegINIClass).

 

Hint:  This means you can convert the rest of your program to use the new class by doing two simple Search/Replace statements.

 

Search for GetINI and replace it with RIC.GetData

Search for PutINI and replace it with RIC.PutData

 

This assumes you are using the global extension template which declares the instance of the class as RIC or have used the same name in your declaration.

 

 

Writing data to the INI file storage method

 

The syntax is:

 

RIC.PutData( Section, Entry, Value, <filename> )

 

Remember that <filename> is ignored by the class and is only there for backwards compatibility.

 

 

Reading data from the INI file storage method

 

The syntax is:

 

RIC.GetData( Section, Entry, Value )

 

 

You can also delete a value (or the entire section of the INI file).

 

Deleting a value from the INI file storage method

 

The syntax is:

 

RIC.DeleteData( Section, Entry )

 

 

Deleting an entire section from the INI file storage method

 

The syntax is:

 

RIC.DeleteData( Section )