Click here to Skip to main content
15,889,808 members
Articles / Programming Languages / C

A C++ Config File Parser

Rate me:
Please Sign up or sign in to vote.
4.23/5 (14 votes)
16 May 2008LGPL31 min read 157.4K   3.7K   47  
An STL based C++ utility class to parse structured config files.
# Demo Config File
# Comments are starting with # (has to be first char)

# Sample entries
helloMessage = Hello, World!
helloCount = 3
showHello = true

# Environment variables used as expansion symbol
# Note: symbol names are case sensitive
tempFolder = %TEMP%

# already defined variables used as expansion symbol
tempSubFolder = %tempFolder%\config-demo

# Sub group example
baseName = Welcome Note
message1 = (
#  strings may use "; it does not make a difference, however.
   name = "%baseName% 1"
   text = Sample message text
)

message2 = (
   name = %baseName% II
   text = Another sample message text
)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions