Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the easiest way to parse an INI File in C++? [closed]

I'm trying to parse an INI file using C++. Any tips on what is the best way to achieve this? Should I use the Windows API tools for INI file processing (with which I am totally unfamiliar), an open-source solution or attempt to parse it manually?

like image 664
conmulligan Avatar asked Aug 15 '08 19:08

conmulligan


People also ask

How do I read a .INI file?

How to Open and Edit INI Files. It's not a common practice for people to open or edit INI files, but they can be opened and changed with any text editor. Just double-clicking it will automatically open it in the Notepad application in Windows.

What is INI parser?

Introduction. iniParser is a simple C library offering ini file parsing services. The library is pretty small (less than 1500 lines of C) and robust, and does not depend on any other external library to compile. It is written in ANSI C and should compile on most platforms without difficulty.

What is INI file in C++?

Introduction. An ini file is a file used to store a list of strings whose considered items use the formula Name=Value. There is no strict rule as to what these files are used for or why. The person who, or the company that, creates such a file also decides what the file would be used for. In Microsoft Windows 3.

Is .ini a text file?

An INI file is a configuration file for computer software that consists of a text-based content with a structure and syntax comprising key–value pairs for properties, and sections that organize the properties.


2 Answers

If you need a cross-platform solution, try Boost's Program Options library.

like image 154
Adam Mitz Avatar answered Sep 20 '22 22:09

Adam Mitz


You can use the Windows API functions, such as GetPrivateProfileString() and GetPrivateProfileInt().

like image 20
Joel Spolsky Avatar answered Sep 20 '22 22:09

Joel Spolsky