INI.SetStrings

Top  Previous  Next

 

Syntax

function INI.SetStrings(INIFile: pointer; NewContents: string): boolean

 

Alternative Names

ibec_ini_SetStrings

 

Description

Replaces the entire contents in the given in memory INI-File with the string in NewContents. You need to call INI.UpdateFile or INI.SaveToFile to actually write the contents to disk.

 

This function Returns TRUE if the value has been set successfully, FALSE otherwise.

 

See also

INI.GetStrings
INI.Create
INI.Open
INI.UpdateFile
INI.SaveToFile

 

Example

execute udsblock(filepath varchar(500))

returns(valueout varchar(2000), valueoutint integer, valueoutdouble double precision)

as

begin

  /* create in memory INI */

  myini = INI.Create();

  

  /* set the filename and save it empty */

  INI.SaveToFile(myini, filepath || 'new_ini_file.ini');

 

  INI.WriteString(myini, 'section1', 'value1', '1');

  INI.WriteString(myini, 'section1', 'value2', '2');

  INI.WriteString(myini, 'section2', 'value1', '1');

  INI.WriteString(myini, 'section2', 'value2', '2');

 

  /* update the file on disk */

  INI.UpdateFile(myini);

  INI.Free(myini);

    

  /* re-open the file */

  myini = INI.Open(filepath || 'new_ini_file.ini');        

  

  /* return entire contents */

  valueout = INI.GetStrings(myini);

 

  INI.Free(myini);

end