While I'm not new to programming, I am new to C++. Most of my time is spent using Free Pascal/Lazarus. With that, I can easily create small procedures to read and write from/to *.ini files. I've made a switch over to C++ and I'm trying to do the same thing.
I don't really know where to start with this. I've viewed a few examples online, even downloading one to use, but the *.cpp file alone is 216 lines long. In contrast, FP/Lazarus Reads and Writes are < 20 lines each.
All I want to do is record cell widths, sash gravity, etc. so the look and feel the user sets up will be there the next time they use the app. I'm using Code::Blocks and wxWidgets. Surely it doesn't take a separate *.cpp and header file just to do this. Or am I wrong?
If you can help me with a shorter way to do this, I'd be grateful. Thanks.
If I understand you, you wan't to read and write from, to files with 'ini' extension?
it doesn't matter what the extension is in case of text files(be it *.txt or no extension at all), simply make use of file stream library: http://www.cplusplus.com/reference/fstream/
how much LOC will take to write does not depend on extension of a text file, that depends on what you need to read and write.
Neither Standard C++ language nor Library contains ready routines for any format.
Everything has to be written "from ground up". The idea is that you could write smarter code for your specific problem.
The code has to be somewhere. In same or separate files. Separate code is easier to reuse in other projects. Libraries are "separate files", usually written by others and (hopefully) reused by many.
There are third-party libraries that can parse INI-file format. For example, a websearch reveals that wxWidgets has "wxConfigFile" for that job.
I appreciate your response and will look into the suggestion. At first glance, my first thought was to run back to Free Pascal as fast as possible =) But I'll give it a shot. Nothing ventured, nothing gained. Thanks again.
keskiverto: I just viewed your post and saw a glimmer light at the end of the tunnel. Thank you.
The VCL/LCL has routines for handling INI files. C and C++ does not. But there are more than a few libraries that do. A quick recurrence to Google will get you something small you can use. Some of them are even #include-only.