I need to be able to edit .ini files (which I’m reading with parse_ini_file), but in such a way that comments and formatting (line breaks, indenting) is preserved.
Do you know any good classes that have nice and optimized functions for this kind of stuff?
You could try starting from this, it reads the ini file, and preserves the settings on write, you would have to extend it to support adding new entries: