Return to Snippet

Revision: 24266
at February 24, 2010 17:13 by jimfred


Initial Code
#include "SimpleIni.h"
#include <stdio.h>

// Linux gcc compilation: 
//   g++ -o test.exe test.cpp
//   gcc -o test.exe test.cpp -lstdc++

int main( int argc, char** argv)
{
  CSimpleIniA ini;

  ini.SetValue("section", "param", "123");
  ini.SaveFile("test.ini");
  
  // Should result in file with contents:
  //   [section]
  //   param=123
  
  ini.LoadFile("test.ini");
  const char * pVal = ini.GetValue("section", "param", "default");
  
  printf( "value=%s", pVal ); // should print "value=123"
  
  return 0;

}

Initial URL
http://code.google.com/p/simpleini

Initial Description
http://stackoverflow.com/questions/12633/what-is-the-easiest-way-to-parse-an-ini-file-in-c

Initial Title
trivial example, C++, gcc, using simpleIni.h

Initial Tags

                                

Initial Language
C++