Jump to content
  • Advertisement
Sign in to follow this  
Rob Loach

INI Files

This topic is 4968 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The win32 api has some basic functions built in for dealing with initialization files, which may make your job easier.

MSDN Reference (scroll down to the Get/WritePrivateProfile*() stuff)

Share this post

Link to post
Share on other sites
Under windows, you can use the GetPrivateProfileString()/WritePrivateProfileString() set of functions for accessing ini files. They're marked as obsolete, but it's unlikely they will be removed anytime soon because they're used by lots of people.

Anyway, I wrote a lightweight ini/cfg file parser some time ago which allows you to navigate an ini file through a simple object model, much like TinyXML for xml files:

int main() {
Confix::Configuration CFG(
"# Simple configuration file\n"
"Hello = World\n"
"Test = 0x40\n"

std::string text = CFG.getSection("SomeSection").getVariable("Hello");
size_t number = CFG.getSection("SomeSection").getVariable("Test");

Might still be a bit larger than what you're looking for, but if you want to check it out: Confix ini file parser (full source is included)


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!