Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


*.ini files

This topic is 5544 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

Does anybody now how to load a *.ini file without using a lot of memory? I tried to but I used a lot of memeory. And memory is limited. So if anybody has an idea. Mail me: thedwarf15@hotmail.com

Share this post

Link to post
Share on other sites
MSDN for WritePrivateProfileString() and ReadPrivateProfileString()

Handling of INI files in windows is possible through Kernel level functions

Share this post

Link to post
Share on other sites
are you looking to read/load the whole thing ... or to extract 1-10 settings out of a large file ???

just like the rules for parsing an XML file ... in xml DOM is best for things where you need to (and can afford to) load the whole file into memory, and read pieces in random orders or more than once ... but SAX is best for things which can be processed once, as read ... or only need to extract specific pieces ...

an INI file can be read like sax ... simply write your search routine to do something like keep track of what [group] you are in ... in some global/class variable or something ... and call a hook function when each actual setting is read ... and when a group change tag is read ... or something like that ...

then your hook could do something like:

if(iniFile.CurrentGroup() == "right_group")
if(iniFile.CurrentSettingLavel() == "right_setting")

and there is no need to store the actual file contents while reading ... except the current group and current line ...

Share this post

Link to post
Share on other sites

  • 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!