ReadPreferenceDouble()

Syntax

Result.d = ReadPreferenceDouble(Key$, DefaultValue)
Description
Try to read the specified associated 'Key$' value.

Parameters

Key$ The key to read the value from. If PreferenceGroup() has been used, then the search is restricted to the current group.
DefaultValue The default value to return if the key isn't found or the preference file haven't been opened correctly (file missing for example).

Return value

The value associated to the specified key, as a double number. if the key isn't found the default value is returned.

Example

  ; Open a preference file
  OpenPreferences(#PB_Compiler_Home +"Examples\Sources\Data\test.pref")
  
  ; Open the group 'Window'
  PreferenceGroup("Window")
  
  ; Examine keys until w = 800
  NextPreferenceKey() ; x = 0
  NextPreferenceKey() ; y = 0
  NextPreferenceKey() ; w = 800
  
  ; Read the key
  cle$= PreferenceKeyName()
  
  ; Display the key and its data with different format
    MessageRequester("Clé Integer", Str(ReadPreferenceInteger(cle$,0)))
    MessageRequester("Clé Float", StrF(ReadPreferenceFloat(cle$,0),6))
    MessageRequester("Clé Double", StrD(ReadPreferenceDouble(cle$,0),15))
    MessageRequester("Clé Long", Str(ReadPreferenceLong(cle$,0)))
    MessageRequester("Clé Quad", Str(ReadPreferenceQuad(cle$,0)))
    MessageRequester("Clé String", ReadPreferenceString(cle$,"0"))
    
  ; Close the preference file
  ClosePreferences() 

See Also

ReadPreferenceFloat(), ReadPreferenceInteger(), ReadPreferenceLong(), ReadPreferenceQuad(), ReadPreferenceString()

Supported OS

All

<- PreferenceKeyValue() - Preference Index - ReadPreferenceFloat() ->