• Welcome to Valhalla Legends Archive.
 

[C++] INI file functions

Started by TruffleShuffle, May 12, 2003, 08:40 AM

Previous topic - Next topic

Yoni


Eibro

Quote from: OriOn on May 17, 2003, 11:21 PM
For information, this is my read/write methods written with c++builder.


// Garbage


More simple ?

Guess what? Not everyone uses Borland. Using the registry limits you to Windows, using TRegIniFile limits you to Borland. Do you understand all the API calls going on underneath the TRegIniFile class? Try using the Win32 API calls to manipulate the registry... I think you'll quickly see manipulating ini files is much easier.
Eibro of Yeti Lovers.

OriOn

Yes i know what behind the TRegistry Class Mr the master programmer. And i know how to use the win32api Mr the master programmer. And use the win32api isnt a lot of more difficult than use the vcl so stop to say wrong things plize and learn :/.

Eibro

Quote from: OriOn on May 18, 2003, 08:03 PM
Yes i know what behind the TRegistry Class Mr the master programmer. And i know how to use the win32api Mr the master programmer. And use the win32api isnt a lot of more difficult than use the vcl so stop to say wrong things plize and learn :/.
No need to get defensive. I never said the Win32 API was any more difficult to use than VCL (I've never used VCL anyway) I was just pointing out that when others refer to manipulating the registry, they're probably not talking about using VCL to do so. That would be like me coming on here and saying it's simple to make a binary bot, it only requires three statements:
BnetBot myBot("useast.battle.net", 6112);
myBot.LoadConfig("config.ini");
myBot.Connect();
Unless others use the same libraries I do, making such comparisons is pretty useless.
Eibro of Yeti Lovers.

MrRaza

If you just using 5 API functions your not using the registry to your full advantage.

OriOn

Ok this my last post about registry and .ini files.
I repeat. Depends af the case, i will be more effective to store data in a file or in the registry.
For fiew config data, i think that the registry is more effective.

To Eibro : i prefer and i have done  my own bot for A to Z. I don t use some libraries or like that. In your last post you don t print the code of your LoadConfig procedure. Your post is a joke ?

To MrRaza : I agree that they are more api routines to use the registry. But i speak about "store  and read config data". And for this works u only need 5 api :
- RegOpenKey
- RegCloseKey
- RegCreateKey / RegCreateKeyHex
- RegQueryValue / RegQueryValueHex
- RegSetValue / RegSetValueHex

I make my best effort to be understood with my poor english.

Banana fanna fo fanna

Both have their merits. Live with it and pick the best choice for your project.
My 2cents: use registry to store stuff like window positions, and ini files for user profiles, like username/password/cdkey/etc.

OriOn

Yes, i store the log of the chan in a file not in the registry :p

Banana fanna fo fanna

Not really what I meant...but that works.

Skywing

#24
Quote from: OriOn on May 17, 2003, 11:00 PM
You only need 5 api to do ur works. I use the registry for many years and i have no problem with it. It's more flexible and easiest than an .ini file. I don t see why you speak about the "legendary" stability of the microsoft os, this argument has no value ( Flame ??) . Backup ur data isn't a problem too . Today u have the same chance to corrupt your registry than ur .ini file. (Do u know the security mechanisms of the registry ?, or u have windows 95).
why 99.9 % of the developpers use the registry ? 99.9 of the developpers are in the wrong way ? :)
For few data, (config data), i repeat that the registry is very simple to use. (i have try registry and ini files)

Sorry for my poo english
I'm not sure if this is a meaningful response, as I can barely understand your post.

Windows keeps the registry locked when running.  In particular, you can't read from it while you've got Windows up, which means you can't make a copy of it.  Under Windows NT, there's a (complicated) API for backing up and restoring registry keys.

If part of a registry hive file is damaged, Windows tends to not load the whole thing and refuse to boot.  There's no really easy way to restore a working copy on a dead system - either you reinstall with the exact same file paths and (somehow) copy over the old registry database and hope it works, or if you're using Win2K, you might be able to use the "emergancy recovery disks", if you made those.

I can easily boot from a floppy and edit an INI file - however, again, there's no simple or easy way to do this with the registry.  Windows 9x Regedit can be used in DOS, but it's unwieldy and difficult to use at the best (I've had the misfortune of having to spend many hours trying to use it to change a few values to make a Windows 98 system bootable again).

Plus, you've got the added advantage of configuration files portable between operating systems.  For example, there are Unreal Tournament versions for Linux and Win32 which both share the exact same INI configuration file format; you can swap configuration files from Windows and Linux and have them work perfectly (something I've done myself; it's a useful feature, not something you'd rarely touch).  You can hardly say the same for the registry.