Skip to content

Commit

Permalink
Update README.md to include new overwriteDuplicateFields option
Browse files Browse the repository at this point in the history
  • Loading branch information
amelsmajic committed Jan 22, 2024
1 parent 2d229f5 commit 3d48174
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,21 @@ int main()
}
```

When duplicate fields are decoded the previous value is simply overwritten by default. You can disallow duplicate fields from being overwritten by using the ```allowOverwriteDuplicateFields(false)``` function. If you do this, an exception will be thrown if a duplicate field is found inside a section.

```cpp
#include <inicpp.h>

int main()
{
// load an ini file
ini::IniFile myIni;
myIni.allowOverwriteDuplicateFields(false);
// throws an exception if the ini file has duplicate fields
myIni.load("some/ini/path");
}
```

Sections and fields can be accessed using the index operator ```[]```.
The values can be converted to various native types:

Expand Down

0 comments on commit 3d48174

Please sign in to comment.