|
#pragma warning (disable : 4786)
#include <string>
#include <vector>
using namespace std;
#include "ini_file.h"
void usage(char ** argv)
{
printf("\nUsage : %s ini_file\n", argv[0]);
}
void PrintIniFile(CIniFile &ifile)
{
int i;
for (i=0;i<ifile.GetNumCategories();i++)
{
ifile.SetCategory(i);
printf("Cat %d = [%s]\n", i, ifile.GetCategoryName().c_str());
int j;
for (j=0;j<ifile.GetNumEntries();j++)
{
ifile.SetEntry(j);
printf("Entry %d [%s]=[%s]\n", j, ifile.GetEntryName().c_str(), ifile.GetEntryValue().c_str());
}
printf("\n");
}
}
int main(int argc, char ** argv)
{
if (argc != 2)
{
usage(argv);
}
else
{
CIniFile ifile;
ifile.LoadFile(argv[1]);
switch (ifile.m_status)
{
case 0:
PrintIniFile(ifile);
break;
case 1:
printf("Cannot open input file !\n");
break;
case 2:
printf("Some error occured while parsing input file !\n");
PrintIniFile(ifile);
break;
default:
break;
}
}
return 0;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.