In addition, any comments that are already in the configuration file should be preserved when writing it back out. It is quite frustrating to create a nice example ini file for a user with comments explaining the options only to have them disapper as soon as the file is saved by the application.
Mark Yedinak Certified LabVIEW Architect LabVIEW Champion
"Does anyone know where the love of God goes when the waves turn the minutes to hours?" Wreck of the Edmund Fitzgerald - Gordon Lightfoot
There is some support for comments in ini files. I doubt much people will know about this, and it is, arguably, fairly useless. It's also not the comment as people would like it to be. But I'll share this, maybe someone will find it useful, or amusing.
[section]
key= 123 ; comment
This works. The key can be written as integer, and the comment persists! The comment can also be read by reading the string value.
However, writing this comment value isn't possible. Even writing a raw string will result in a quoted string, where the comment is included between the quotes.
The ini file internals have a separate space for key comments. It's just never exposed in the API...
I'm all for adding support for comments. Writing my own ini file library, I know it's not that easy. It's not just adding, you'll probably want to have full control over comment, empty lines, keys and sections. For instance, add an empty line, but only if there isn't one already. It's not trivial to design an API that supports everything.