Save settings to .INI file - %ss[filename/section]

Saves the supplied variables to an .INI file that is automatically located in the Windows directory, not the current working directory (the format of an .INI file is illustrated below). When the program is rerun the variables stored in the .INI file will automatically be restored (whenever the windows containing the %rs, %rd or %rf controls are displayed). The file name string (without the extension .INI) must be supplied in square brackets followed by a (/) character and the section name that will be used in the .INI file. The item name (within the section) is formed automatically from the text that appears immediately before the (%rd, %rf, %rs) format code.

A control argument of type INTEGER must also be supplied. This is a 'save' control flag that prevents the automatic saving of values when set to zero. This is useful when an abort/abandon path is taken rather than a clean exit, thus preventing erroneous or incomplete data from being stored. %ss should be placed before the first (%rd, %rf, %rs) format code.

For example:

 INTEGER num,save_control,i
 CHARACTER*20 directory
 save_control=1
 num=0
 directory=' '
 i=winio@('%ss[file/section]&',save_control)
 i=winio@('Users: %rd%nl&',num)
 i=winio@('Path:  %rs',directory)

If the user enters '12' and 'c:\temp' into the two edit boxes, this creates a file called file.ini in the Windows directory containing:

[section]
Users=12
Path=c:\temp

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited