CINIFile
The ZIP file that contains the class, readme, and a class on which it depends for some of its functions called CConversion.
Version: v1.0.0
Size: 10KB
Download: Here
Requirements
The class was written in Visual C++ 2002 (MFC) so you will probably need at least that. I have not tested it on anything less.
Version 1.0.0
The main code help (MSDN style) is here. It thoroughly documents all aspects of the class.
Here are some code snippets that shows you how to basically use the class:
Writing to an INI File
CINIFile INIFile(m_strAppPath + "Options.ini");
BOOL bRetVal;
int nKeyIndex;
nKeyIndex = INIFile.AddKey("Test Key");
INIFile.AddValue(nKeyIndex, "Test CString", "Test Data YEAH");
INIFile.AddValue(nKeyIndex, "Test Double", 0.0115214);
INIFile.AddValue(nKeyIndex, "Test Integer", 5);
bRetVal = INIFile.WriteINIFile();
Reading from an INI File
CINIFile INIFile(m_strAppPath + "Options.ini");
BOOL bRetVal;
int nKeyIndex;
int nKeyIndex2;
double dtest;
CString strTest;
int nTest;
bRetVal = INIFile.ReadINIFile();
nKeyIndex = INIFile.GetKeyIndex("Test Key");
INIFile.ReadValue(nKeyIndex, "Test Double", dtest);
INIFile.ReadValue(nKeyIndex, "Test CString", strTest);
INIFile.ReadValue(nKeyIndex, "Test Integer", nTest);
If you have problems using the class or have some bugs please email me. See the Contact page.
Alternately you could ask on the forums:
[Code Snippets Forum]