And they are ?. Please Luis.
Oh, I have replied with some of the reasons in another post, but here we go:
1) Security. Imagine your program is shared by 5 users that use your
computer. Your wife have some settings, but you like some others. The kinds
use some other settings. The program needs a way to separate the settings
for every user. Sure , this can be implemented using ini files but: if you
use only a ini file, then you have no security at all. If an user deletes
the file, all the settings of all users are gone. If you store important
settings or passwords, then some user could maliciously delete or change
those settings. Using the registry makes this automagically easy: use the
key
HKEY_CURRENT_USER\Software
No other user than you (or of course, root) can access this key. They cannot
even read it.
2) Multithreading issues. Supose you have yor settings in an ini file. Your
program span several threads or, say, several instances of itselve. Supose
thet all the instances modify some settings and they need to write them to
the ini file. Sure, you can use mutexes or WaitForSingleObject to
synchronize, but, why? The registry is a database. Thread safe. End of the
story. You can have 100 instances reading/writing to the registry at the
same time. No problem, the registry handles this. And way more.
3) Flexibility. An ini file can store, well, strings. The registry can store
Ansi strings, unicode strings, binary objects, you name it.
4) Speed: The registry is always in memory. Accessing a registry key is
musch faster than accessing the dis, loading the ini file and parsing it.
Yes, everything can be done using ini files too, but it is a lot more work.
I use myself ini files sometimes, but only if I have plans to port some
program to some other OS, otherwise, I often use the registry.