(System Library)
Description: This subroutine writes an entire section to an .INI file or a buffer containing one and returns its error code.
Returns: Numeric
Usage: Script
Format: \System\WriteSectINI(File, Section, VarList [, UseBuff])
Parameters: File { text } { required } { no default: }
Any text expression giving the full path and file name of the .INI file or the name of the buffer containing its contents.
Section { text } { required } { no default: }
Any text expression giving the name of the section in the file; this should not include the square brackets delimiting the section.
VarList { Array } { required } { no default: }
A 2 dimensional array containing the variables and their values to write to the file. The first row, VarList[0][N], contains the variable names, while the second row, VarList[1][N] contains their values.
UseBuff { Boolean } { optional } { default: false }
An optional parameter that is any logical expression; if true (non-0) the value of File must be a pointer to a buffer, if false (0) it is a file that is to be used. The default used if this parameter is omitted is false.
Comments: This subroutine is a member of the System Library, and must therefore be prefaced by \System\, as shown in the "Format" section. If the application you are developing is a script application, the System variable must be declared in APPMOD.SRC and need not be prefaced by a backslash in the function call.
The subroutine returns true (1) if the write was successful and invalid otherwise. If the .INI file or the section does not exist, they will be created. If the VarList parameter is invalid, a blank section will be created. This is a destructive write; that is to say, the entire section of the file is overwritten by the new section, regardless of the contents of either.
Searches performed by this function are case insensitive. Alignment of equal signs in the file is preserved.
Example:
If 1 Main;
[
Vals[0][0] = "AutoLogoff";
Vals[1][0] = 5;
Vals[0][1] = "AutoLogoffMin";
Vals[1][1] = 3;
System\WriteSectINI("Config.INI" { Name of file },
"SecMgr-Admin" { Name of section },
Vals { Arrays of data },
0 { Write file format });
]
This causes the variables AutoLogOff and AutoLogoffMin in the SecMgr-Admin section of the Config.INI file to have their values set to 5 and 3 respectively.
See Also:
CheckFileExist | CheckPathExist | Edit | Folder | ReadINI | ReadSectINI | WriteINI