Comments (2)
You will need to make sure the string is not empty.
Here is a snippet where I am using this lib:
for (const auto& setting : settings) {
std::string& strval = ini[section][setting->name];
if (strval.empty()) {
continue;
}
int val = std::stoi(strval);
if (val >= setting->min && val <= setting->max) {
setting->val = val;
}
}
You can also use has
if you want to achieve the same goal in a different way. In my case, I want the non-existent settings to be created, so I do it the way shown above.
from mini.
Thanks!
from mini.
Related Issues (17)
- Subject to multiple definition errors. HOT 1
- Location of the file in linux HOT 2
- Support for std::wstring HOT 5
- Cannot read ini files with utf-8 BOM encoding properly HOT 6
- mIni doesn't parse properly strings HOT 4
- Warnings on Windows with VS2022 MSVC /W4 HOT 1
- this is the best lib for ini that i have ever tried HOT 3
- trailing comments on all lines HOT 4
- Output is being prefixed with gabage HOT 6
- Read a value and get a reference only if exists HOT 1
- not support multiple data types to return HOT 2
- No support for reading from stringstream or char buffer? HOT 1
- const std::string HOT 1
- how about cross platform? HOT 1
- Trying to generate / rewrite the config only if there isn't one HOT 1
- no support comment to the right value
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mini.