A simple .ini file interface.
Dependents: Smart-WiFly-WebServer SignalGenerator WattEye X10Svr
Diff: IniManager.cpp
- Revision:
- 27:611ffb74fd38
- Parent:
- 25:1362b843de86
- Child:
- 28:4e7fc08a0fea
--- a/IniManager.cpp Sun Nov 11 22:56:13 2018 +0000 +++ b/IniManager.cpp Sun Nov 18 04:06:59 2018 +0000 @@ -20,10 +20,10 @@ #include <cstdio> #if (defined(DEBUG) && !defined(TARGET_LPC11U24)) -#define DBG(x, ...) std::printf("[DBG %s %3d] "x"\r\n", DEBUG, __LINE__, ##__VA_ARGS__); -#define WARN(x, ...) std::printf("[WRN %s %3d] "x"\r\n", DEBUG, __LINE__, ##__VA_ARGS__); -#define ERR(x, ...) std::printf("[ERR %s %3d] "x"\r\n", DEBUG, __LINE__, ##__VA_ARGS__); -#define INFO(x, ...) std::printf("[INF %s %3d] "x"\r\n", DEBUG, __LINE__, ##__VA_ARGS__); +#define DBG(x, ...) std::printf("[DBG %s %4d] "x"\r\n", DEBUG, __LINE__, ##__VA_ARGS__); +#define WARN(x, ...) std::printf("[WRN %s %4d] "x"\r\n", DEBUG, __LINE__, ##__VA_ARGS__); +#define ERR(x, ...) std::printf("[ERR %s %4d] "x"\r\n", DEBUG, __LINE__, ##__VA_ARGS__); +#define INFO(x, ...) std::printf("[INF %s %4d] "x"\r\n", DEBUG, __LINE__, ##__VA_ARGS__); #else #define DBG(x, ...) #define WARN(x, ...) @@ -110,7 +110,7 @@ if (!iniFile) return found; CleanUp(); - INFO("GetNextLey after [%s]", after); + INFO("GetNextKey after [%s]", after); FILE * fp = fopen(iniFile,"rt"); if (fp) { char buf[INTERNAL_BUF_SIZE]; @@ -422,7 +422,7 @@ } inSection = false; // write old record - fprintf(fo, "%s\r\n", buf); + fprintf(fo, "\r\n%s\r\n", buf); INFO(" write: %s", buf); if (br) { *br = '\0'; @@ -472,7 +472,7 @@ Rename(newFile, iniFile); // move the new .new to .ini INFO(" c"); #ifdef RTOS_H - Thread::wait(1000); + Thread::wait(1000); // this seems to help with file contention #else wait(1); #endif