Comments (3)
I wonder how to initialize an INI file while instantiating an object, Is it possible to add such a function?
from inifile-cpp.
Hi ARC-MX,
could you provide a bit more information on how you want to initialize an INI file or what your goal is?
You can directly load an INI file into a IniFile object using its constructor:
IniFile myIni("path/to/some_file.ini");
Directly deserializing a INI file into an object is currently not possible. Also the other way around is not possible. Moving the data of a inifile to a custom struct or class must be handled by the implementer.
from inifile-cpp.
I want to initial the “file.ini” while it doesn't create when my code is frist-run like this:
`
std::ifstream is("hardwareConfig.ini");
if (is.good() == false) {
std::cout << "open "
<< "hardwareConfig.ini"
<< "field, this is found";
ini::IniFile inif;
inif["Weight"]["startAddr"] = 0x400000000;
inif["Weight"]["maxSize"] = 0x100000000;
inif["Weight"]["gpioPinOfMemReady"] = 1;
inif["Instruction"]["startAddr"] = 0xA1000000;
inif["Instruction"]["maxSize"] = 0x10000;
inif["Instruction"]["gpioPinOfMemReady"] = 3;
inif["FeatureMap"]["startAddr"] = 0xA0000000;
inif["FeatureMap"]["maxSize"] = 0x200000;
inif["FeatureMap"]["gpioPinOfMemReady"] = 2;
inif["Control"]["gpioInBase"] = 501;
inif["Control"]["wpuInterruptEvent"] = 0;
inif["Control"]["weightControlerReady"] = 1;
inif["Control"]["userPlkey"] = 3;
inif["Control"]["gpioOutBase"] = 504;
inif["Control"]["start"] = 0;
inif.save("hardwareConfig.ini");
debugCout << "Saved ini file." << std::endl;
}
ini::IniFile inif;
inif.load("hardwareConfig.ini");
debugCout << "Has " << inif.size() << " sections" << std::endl;
`
I just don't know how to add an init function to inicpp.h file to do that
from inifile-cpp.
Related Issues (20)
- Add static default IniFile members
- Ignore non-significant spaces HOT 2
- Disallow section duplication HOT 1
- Why not HOT 1
- Changeable comment char
- ini parsing failed, section not closed HOT 4
- Add semicolon ";" to comment prefixes
- Comments and line separators getting deleted while saving HOT 5
- Add uint and float field
- Disable program crash if invalid input HOT 5
- Disable sorting HOT 7
- By not existing keys returns 0 HOT 4
- Add dependency install script
- Restoring the master branch HOT 2
- Update to newer Catch version
- Add appveyor CI
- Check existence of field and section
- Allow empty section
- Make header only
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 inifile-cpp.