PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

ini type file reader

Hi,

I've looked through loadsa forums but to no avail.

I am about to write a C++ file reader to read text files which contain initialization and parameter info.

What I hope the file will look like is

[control]
orientation=landscape
sound=50
menu=1,4,3,5

I believe that most of you (programmers) will have used something like this in the past and I did not want to reinvent the wheel.

Can anybody offer some pointers to save me some time?

Thanks in advance
Bad
Certainly. Jaap wrote an excellent ini file implementation for the Overloaded libraries. You're quite welcome to 'take a look at it'. It does use STL btw.
BurningSheep · 29 Jul 2002, 14:08 UTC
meh, .ini files have been obsolete for 7 years now, i'd go for XML!
what is the advantage of XML over ini?
Thanks for the rapid replies :)

Phantom: is STL ok on PPCs? Not used them before but am looking into them now.

BurningSheep: XML?

Thanks again
Bad
BurningSheep · 29 Jul 2002, 14:45 UTC
STL:

I use stlport in almost all of my PocketPC projects, it's working really great... once you get it working :) It took me some time to get it working right, but it is worth the trouble. I believe in eVC4 it is implemented standard.


XML:

No licenses, platform independent, well supported, lots of tools available on the internet.
the MSXML parser is already installed on your device, waiting to be used :)

You can easily edit an XML file... not really an advantage over .ini files, but definitely an advantage over the registry.

Complex data types, you can hack your way around this with ini files, but with XML files it's standard. Using XML your data is much better structured

for instance:

Code:

<employee id=101>
<name>
<firstname>Robert</firstname>
<lastname>Schaap</lastname>
</name>
<address>
<street>...</street>
<zipcode>...</zipcode>
<country>...</country>
etc...
</address>
</employee>


I've seen people do this in ini files, where they would separate the datafields by a | or something, not pretty

Validating using DTDs can also come in handy, it allows you to check whether your xml .ini file is valid or not. If you use an XML editor you can even validate within the editor.

Anyways, XML is very flexible, you don't have to stop at .ini files. Just keep it in mind, it's not the best solution for every programming problem, but definitely worth looking into.