What's the best way for a ini file ?
What's the best way for a ini file ?
Hi guys,
I have all the settings for my application stored on constants. It is ok if you do not plan to change the settings like folder locations, database name etc.
But I think I need to give more flexibility in case someone else uses my application in another computer. So, as I can not read settings from a file and assign to it to an constant, is there a standard or best practice to load settings to your PB application like an ini file ? In fact it would be great to read data from a file and assign to a constant as I feel more secure that way. Any suggestion or experience in this issue will be welcome.
Thanks all.
			
			
									
									
						I have all the settings for my application stored on constants. It is ok if you do not plan to change the settings like folder locations, database name etc.
But I think I need to give more flexibility in case someone else uses my application in another computer. So, as I can not read settings from a file and assign to it to an constant, is there a standard or best practice to load settings to your PB application like an ini file ? In fact it would be great to read data from a file and assign to a constant as I feel more secure that way. Any suggestion or experience in this issue will be welcome.
Thanks all.
- netmaestro
 - PureBasic Bullfrog

 - Posts: 8452
 - Joined: Wed Jul 06, 2005 5:42 am
 - Location: Fort Nelson, BC, Canada
 
I think he's referring to the preferences library that's built into PB.jmauver wrote:Hi netmaestro,netmaestro wrote:How about the preferences library?
You mean I create a preferences library ? Or there is a library for this purpose ? I searched the forum and could not find it. If there is a library, could you tell the link ?
Thanks a million.
I love Purebasic.
						You can found the preference lib in the HelpFile from PB  
			
			
									
									PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

						Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

- Kaeru Gaman
 - Addict

 - Posts: 4826
 - Joined: Sun Mar 19, 2006 1:57 pm
 - Location: Germany
 
- Kaeru Gaman
 - Addict

 - Posts: 4826
 - Joined: Sun Mar 19, 2006 1:57 pm
 - Location: Germany
 
The only downside I found with the preferences library is that you can't easily rename a group.
http://www.purebasic.fr/english/viewtopic.php?t=32119
			
			
									
									
						http://www.purebasic.fr/english/viewtopic.php?t=32119


