INI.Open |
Top Previous Next |
Syntax function Ini.Open(Filename: string): pointer
Alternative Names
DescriptionOpens an existing INI-file with the given Filename and loads it into memory so that it can be used to read and write values. Use INI.UpdateFile to flush the contents to file. You can destroy the object using INI.Free.
An existing INI-file can also be saved to a file with a different name using INI.SaveToFile.
Returns a INI file object if successful, or NULL otherwise.
See also
Example execute udsblock(filepath varchar(500)) returns(testno integer, valueout varchar(2000), valueoutint integer, valueoutdouble double precision) as begin /* open existing file */ myini = INI.Open(filepath || existing_ini_file.ini');
/* clear the in memory copy of the file */ INI.Clear(myini);
INI.WriteString(myini, 'section1', 'value1', '1'); INI.WriteString(myini, 'section1', 'value2', '2'); INI.WriteString(myini, 'section2', 'value1', '1'); INI.WriteString(myini, 'section2', 'value2', '2');
/* get the complete INI as a single string */ valueout = INI.GetStrings(myini);
/* overwrite complete in memory copy of the file */ INI.SetStrings(myini, '[section1]' || String.CRLF() || 'value0=2'); valueout = INI.ReadString(myini, 'section1', 'value0', 'default');
INI.WriteInteger(myini, 'section1', 'intvalue', 666); valueoutint = INI.ReadInteger(myini, 'section1', 'intvalue', 0); INI.WriteFloat(myini, 'section2', 'floatvalue', 666.66); valueoutdouble = INI.ReadFloat(myini, 'section2', 'floatvalue', 0);
/* erase section "section1", "section2" still exists */ testno = 5; INI.erasesection(myini, 'section1'); valueout = INI.GetStrings(myini);
INI.UpdateFile();
INI.Free(myini); end |