A demo of the iniparser library. It contains the iniparser library. It's not very memory efficient but it works fine.
Diff: main.cpp
- Revision:
- 0:670712c250da
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Dec 11 15:58:40 2009 +0000 @@ -0,0 +1,30 @@ +#include "mbed.h" +#include "iniparser.h" + +/* iniparser - an INI file parser under mit licence. + url: http://ndevilla.free.fr/iniparser/ + doc: http://ndevilla.free.fr/iniparser/html/index.html +*/ + +#if 0 // content of foo.txt +[sec1] +foo = bar ; command +quax = 42 + +[sec2] +foo = 0; nope +#endif + +DigitalOut myled(LED1); +LocalFileSystem local("local"); +int main() { + dictionary *dir = iniparser_load("/local/foo.txt"); + printf("sec1: %s\n", iniparser_getstring(dir, "sec1:foo", "default")); + printf("sec2: %d\n", iniparser_getint(dir, "sec2:foo", 42)); + while(1) { + myled = 1; + wait(0.2); + myled = 0; + wait(0.2); + } +}