Skip to content

Comments and line separators getting deleted while savingΒ #29

@sukesh-ak

Description

@sukesh-ak

@Rookfighter Thank you for this useful library.

I noticed that after updating the values and calling save option, all the comments and empty lines in the ini file gets removed.
Since most of these files are edited manually by users, retaining comments and white spaces are essential while saving.

Sample ini file

# Send a message to the world
[world]
message=Hello

# Just foo :)
[foo]
f1=123

Sample code

#include <inicpp.h>
int main()
{
    ini::IniFile myIni;
    myIni.load("some/ini/path");

    myIni["world"]["message"] = "Hello world";

    myIni.save("some/ini/path");
    
}

Result after saving the file

[world]
message=Hello world
[foo]
f1=123

Do let me know if there is already an option to avoid them being removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions