Opens the relevant .ini file for reading and writing.



Argument Description
name The filename for the .ini file.

Returns: N/A


This opens an ini_file for reading and/writing. If the ini_file does not exist at the location you are checking, GameMaker: Studio may create one, but only if you write data to it. If you have only read information from the ini file, then the default values for the read function will be returned, but the ini file will not actually be created.

Please note that you can only have one ini file open at any one time and remember to use ini_close once you're finished reading/writing from the .ini file as the information is not actually stored to disk until then (it is also stored in memory until the file is closed).

WARNING! This function may not work as you expect due to GameMaker: Studio being sandboxed! Please see the section on File System Limits for more information.


score = ini_read_real("save1", "score", 0);

This will open 'savedata.ini' and read the score 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 (the default value).

Back: Ini Files
Next: ini_close
© Copyright YoYo Games Ltd. 2015 All Rights Reserved