Rolf Meyer / Mbed 2 deprecated iniparser

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "iniparser.h"
00003 
00004 /* iniparser - an INI file parser under mit licence.
00005    url: http://ndevilla.free.fr/iniparser/
00006    doc: http://ndevilla.free.fr/iniparser/html/index.html
00007 */
00008 
00009 #if 0 // content of foo.txt
00010 [sec1]
00011 foo = bar ; command
00012 quax = 42
00013 
00014 [sec2]
00015 foo = 0; nope
00016 #endif
00017 
00018 DigitalOut myled(LED1);
00019 LocalFileSystem local("local");
00020 int main() {
00021     dictionary *dir = iniparser_load("/local/foo.txt");
00022     printf("sec1: %s\n", iniparser_getstring(dir, "sec1:foo", "default"));
00023     printf("sec2: %d\n", iniparser_getint(dir, "sec2:foo", 42));
00024     while(1) {
00025         myled = 1;
00026         wait(0.2);
00027         myled = 0;
00028         wait(0.2);
00029     }
00030 }