CreatePreferences()
Syntax
Result = CreatePreferences(Filename$ [, Flags])Description
Creates a new empty preference file. If the file already exists, the file is erased.
Parameters
Filename$ The filename of the new preference file. Flags (optional) It can be a combination of the following values: #PB_Preference_NoSpace: no spaces will be put around the equal sign joining key and values. It can be useful when dealing with external preferences files which doesn't accept spaces around equal sign. #PB_Preference_GroupSeparator: add an empty line between the groups to ease readability of the file.
Return value
Nonzero if the file has been successfully created, zero otherwise.
Remarks
Once created, the functions like WritePreferenceString() can be used to write data. When values are written in preferences, it's possible to read them back with the functions like ReadPreferenceString().
To remove a key or a group, use RemovePreferenceKey() and RemovePreferenceGroup(). To create or change the current group, use PreferenceGroup().
Once all write operations are done, ClosePreferences() needs to be called to really write the preferences back to disk.
Example
; Create a preference file nammed Setup.ini CreatePreferences(GetTemporaryDirectory()+"Setup.ini") ; Create a group named "Window" PreferenceGroup("Window") WritePreferenceLong ("X", 10) ; X = 10 WritePreferenceLong ("Y", 10) ; Y = 10 WritePreferenceLong("W", 800) ; W = 800 WritePreferenceLong("H", 600) ; H = 600 WritePreferenceFloat("%", 20) ; % = 20.000000 WritePreferenceString("Title", "PureNote") ; Title = "PureNote" ; Close the preference file ClosePreferences()
See Also
ClosePreferences()
Supported OS
All