ini_close

Closes the currently open .ini file.

Syntax:

ini_close();


Returns: String


Description

This function should be called the moment you are finished reading or writing to any open ini file. If you do not use the function after you have used any of the ini write functions, then nothing will be written to disk, as the file information is held in memory until this function is called, which forces the write. If you try to open an ini without having previously closed another one (or the same one) you will get an error too.

The function will also return a string with the ini file encoded into it. This string can then be saved to a server and/or used again along with the function ini_open_from_string to re-create the ini.


Example:

ini_open("savedata.ini");
score = ini_read_real("save1", "score", 0);
ini_close();

This will open 'savedata.ini' and set score to the value under the section "save1" with the key "score" in it, then close the .ini again. Should there be no value under "save1", "score" or there is no "savedata.ini" file present, score will be set to 0 and a new ini_file created.


Back: Ini Files
Next: ini_write_real
© Copyright YoYo Games Ltd. 2018 All Rights Reserved