-2
\$\begingroup\$

I'm currently working on a Project which needs to store some values (in the form of parameter lists). These values can be of some defined types (uint32, char[], ...). Now I would like to make these parameter lists persistent, meaning I want to load and save them. I also want to be able to "download" them to the computer and edit them there, then upload them again to the device which will then use them.

Until now, I have used a simple text file which features Key-Value pairs such as:

EnterTime=18.0\n
DisallowTime=3\n
EnterMessage=Hello this is me\n
ExternalPhoneNumber=+1212345678
...

Yet, I think that there must be a better approach. Space is not a real problem, but I'm not sure if I want to switch to XML, I don't think that would be a better approach.

Any ideas on this? How do you handle such a situation?

Kind regards Thomas

\$\endgroup\$
3
  • \$\begingroup\$ what you actually want, some library to parse this and use values in your computer application? You could simply communicate parameters using a serial port. \$\endgroup\$ Oct 29, 2012 at 19:59
  • 1
    \$\begingroup\$ I don't see this as an electronics question. \$\endgroup\$ Oct 30, 2012 at 22:14
  • \$\begingroup\$ Not a real electronics question. \$\endgroup\$ Dec 20, 2012 at 7:06

1 Answer 1

2
\$\begingroup\$

XML may be a better approach when you want to share your data through web and internet or make it inter-operable with another application. If you using a single standalone application and you don't have tree like data structure to be stored, My suggestion is to use simple key value based file that you already came with.

There are ready-made libraries for you to parse your such text files. Take a look at this: http://cfgparser.sourceforge.net/

Or you could simply code a recursive decent parser by yourself.

\$\endgroup\$
1
  • \$\begingroup\$ Alright, I already thought that this might be the most efficient way .. Back to the roots :) \$\endgroup\$
    – Tom L.
    Nov 2, 2012 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.