WritePreferenceInteger()

Syntax

WritePreferenceInteger(Key$, Value)
Description
Creates or changes the specified key and its associated integer value under the form: 'Key$ = Value' in the preference file, previously created with CreatePreferences() or opened with OpenPreferences().

Parameters

Key$ The key name to write. If PreferenceGroup() has been used, then the write is restricted to the current group. If the key was already created, its associated value is replaced with the new specified value.
Value The integer value to associate with the key.

Return value

None.

Example

  ; Create a 'test.ini' preference file in the users temp folder.
  ; Since we don't store many values, we don't create PreferenceGroups...
  If CreatePreferences(GetTemporaryDirectory()+"test.ini")
    WritePreferenceInteger("x", 35)
    WritePreferenceInteger("y", 46)
    WritePreferenceInteger("w", 200)
    WritePreferenceInteger("h", 100)
    ClosePreferences()
  Else
    Debug "Error: Can't create the 'test.ini' file!"
  EndIf
  
  ; Read that file and output the values
  If OpenPreferences(GetTemporaryDirectory()+"test.ini")
    Debug ReadPreferenceInteger("x", 0)
    Debug ReadPreferenceInteger("y", 0)
    Debug ReadPreferenceInteger("w", 400)
    Debug ReadPreferenceInteger("h", 600)
    ClosePreferences()
  Else
    Debug "Error: Can't open the 'test.ini' file!"
  EndIf
For another example see at WritePreferenceFloat().

See Also

WritePreferenceFloat(), WritePreferenceDouble(), WritePreferenceLong(), WritePreferenceQuad(), WritePreferenceString()

Supported OS

All

<- WritePreferenceFloat() - Preference Index - WritePreferenceLong() ->