INI.SaveToFile

Top  Previous  Next

 

Syntax

function INI.SaveToFile(INIFile: pointer; NewFilename: string): boolean

 

Description

This sets the in memory INI-file previously created with INI.Open or INI.Create to the NewFilename and directly saves it to disk.

 

This function Returns TRUE if the contents is properly flushed to disk, FALSE otherwise.

 

See also

INI.Create
INI.Open
INI.UpdateFile

 

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