Page 1 of 1

Better handling of Preference-Files (INI)

Posted: Thu Nov 16, 2006 2:07 pm
by AND51
Hello!

Normal file operations are controlled by using IDs. Why don't do the same with Preference-Files (INI-Files).

For example, this code doesn't work:

Code: Select all

CreatePreferences("1.ini")
	WritePreferenceString("111", "111")
	
	CreatePreferences("2.ini")
		WritePreferenceString("222", "2222")
	ClosePreferences()
	
	WritePreferenceString("333", "3333") ; This key/val-pair is not written into the first ini-file
ClosePreferences()
In my opinion, it's better to use IDs, because there are many reasons. For example, I must work with 2 INIs in my current projects now: my own and an external INI-file from another program.
Well, the Workaorund to temporaryly open and close the unneeded INI files is bad.

What do you think about my idea? :)

Posted: Thu Nov 16, 2006 3:24 pm
by Tranquil
I "requested" this feature some month ago as Pb4.0 was released.

I wonder if it could be threadsave if no ID is given. Check out Freds answer here:

http://www.purebasic.fr/english/viewtop ... highlight=

Anyway, I would request this feature too again. Its not really really necessary but nice to have. #PB_Any should also be supported then. :D

Mike

Posted: Thu Nov 16, 2006 3:35 pm
by AND51
Oh, da ist er wieder, mein freund der Tranquil... :D
In the other thread, which Tranquil posted, Fred wrote:You can open one per thread (if you compile in threadmode).
Well, I don't know how to use this "workaround"...?

I want to access different INIs at the same time in the same procedure or main program.

Please, Fred or anbody else of the PB team, can you replay to this thread? What do you think about this request? Is it possible to realize this in one of the next versions of PB?

As I and Tranquil said, we recommend the same handling-method as you use with normal files.

Posted: Sun Nov 26, 2006 6:35 pm
by AND51
Please, can someone of the PB-Team write an answer?
One INI per Thread is not that good. I would prefer a kind of ID handling like the file-lib. There you also assign different IDs to different opened files.