Shinichiro Nakamura
/
ConfigFile_TestProgram
A test program for ConfigFile library.
Revision 0:78215cbf31b4, committed 2010-09-12
- Comitter:
- shintamainjp
- Date:
- Sun Sep 12 07:40:20 2010 +0000
- Child:
- 1:d125bda3cf74
- Commit message:
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ConfigFile.lib Sun Sep 12 07:40:20 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/shintamainjp/code/ConfigFile/#f6ceafabe9f8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Sep 12 07:40:20 2010 +0000 @@ -0,0 +1,68 @@ +/** + * Test program for configuration file interface class (Version 0.0.1) + * + * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems) + * http://shinta.main.jp/ + */ +#include "mbed.h" + +#include "ConfigFile.h" + +ConfigFile cfg; +LocalFileSystem local("local"); + +/** + * ================================================== + * Input (input.cfg) + * ================================================== + * # + * # Configuration file for mbed. + * # + * + * MyKey1=This is a value for key1. + * MyKey2=Value 2 + * + * Message1 = This is a test message no.1 + * Message2 = This is a test message no.2 + * + * ================================================== + * Output (output.cfg) + * ================================================== + * MyKey1=This is a value for key1. + * MyKey2=Value 2 + * Message1 = This is a test message no.1 + * Message2 = This is a test message no.2 + * + * ================================================== + * Output (console) + * ================================================== + * 'MyKey1'='This is a value for key1.' + * 'MyKey2'='Value 2' + */ +int main() { + + char *key1 = "MyKey1"; + char *key2 = "MyKey2"; + char value[BUFSIZ]; + + /* + * Read a configuration file from a mbed. + */ + cfg.read("/local/input.cfg"); + + /* + * Read a configuration value. + */ + cfg.getValue(key1, &value[0], sizeof(value)); + printf("'%s'='%s'\n", key1, value); + cfg.getValue(key2, &value[0], sizeof(value)); + printf("'%s'='%s'\n", key2, value); + + /* + * Write a configuration file to a mbed. + */ + cfg.write("/local/output.cfg"); + + while (1) { + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Sep 12 07:40:20 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e