ini_read_real

Reads a saved real value (number) from an .ini file.

Syntax:

ini_read_real(section, key, default);


Argument Description
section The section of the .ini to read from.
key The key within the relevant section of the .ini to read from.
default The value to return if a value is not found in the defined place (or the .ini file does not exist). Must be a real number.


Returns: Real


Description

You can use this function to read a number from an ini data file. Ini files are split into sections and then each section is subsequently split into key - value pairs. So a typical ini file would look something like this:


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 'save1' > 'score' in it, then close the .ini again. Should there be no value under 'save1' > 'score', or there no 'savedata.ini' file present, score will be set to 0.


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