Arduino INI libraryAuthor: Dave Date: 12.17.15 - 1:29pm I was playing around a bit with a couple ini libraries for arduino. The inih library by Ben Hoyt looks like the winner. Its very clean and lite weight. Elegant even. The ini file is only parsed once, and it uses a call back to notify you of each setting found. This allows you to just do a simple strdup on the value instead of having to allocate a static buffer of size X. It also processes lines longer than the line buffer length without error. To use it with teh SD card library from Ardunio all you have to do is define your own fgets implementation and you can use it without modification. Example below: File file = SD.open("private.ini"); if (ini_parse_stream((ini_reader)my_fgets, &file, myini_handler, 0) < 0) { Serial.println("Ini parse failed"); while(1); } file.close(); Comments: (0) |
About Me More Blogs Main Site |