Question

I'm writing a program which needs to take user input to know how to map characters in the sense the user needs to specify something like "a=>b" (a maps to b). There could be quiet a few of these "mappings" (e.g. 10+). I'm planning on using a file that the user can edit. After the initial setup the user will probably not change the settings often. The user is an IT employee so they should be technically incline.

My question is
1)what file format should be used? .txt, .dat, .ini etc.? I want the user to be able to modify this with a text editor such as Notepad.
2)what format should the file contain? Does it make sense "a" => "b" or is there a better conversion or is it really up to me?

Was it helpful?

Solution

It's all up to you. We often use key=value, for what it's worth.

As for the "file format" keep in mind that whatever file extension you use, if it's text then it's just text even if you call it a .jpg. Using a sane extension won't do any harm though, .ini or .conf are quite common.

OTHER TIPS

Instead of reinventing the wheel you could have a look at Boost.PropertyTree. It provides data structures for storing key-value pairs (where in "a" => "b", "a" would be the key and "b" would be the value). And it provides parsers for XML, JSON, INI, and INFO files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top