Support multiple preference files

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Didelphodon
PureBasic Expert
PureBasic Expert
Posts: 450
Joined: Sat Dec 18, 2004 11:56 am
Location: Vienna - Austria
Contact:

Support multiple preference files

Post by Didelphodon »

It would be really cool if the preference library would follow the conventions/strategy in other libraries (ie. file library) to return an unique handle/pointer to use in following instructions.
Having only 1 preference file accessible at one time is sometimes (in my cases often) not sufficient. Especially when you do include libraries and want to store/load states within a procedure you cannot rely on that the "upper" code has not already opened a preference file.
Go, tell it on the mountains.
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: Support multiple preference files

Post by Tenaja »

In the meantime, always close the pref file after you have completed your immediate need of reading or writing to it, and you will not have issues. It is not good practice to leave a file open longer than necessary. You should close it as soon as "immediate" access has concluded.
Post Reply