/ Published in: C++
http://stackoverflow.com/questions/12633/what-is-the-easiest-way-to-parse-an-ini-file-in-c
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#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; }
URL: http://code.google.com/p/simpleini