parse settings file

Windows specific forum
User avatar
Brujah
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Nov 03, 2003 7:45 pm
Location: Germany
Contact:

parse settings file

Post by Brujah »

My game uses a settings file that looks like this:

Code: Select all

# Lost Labyrinth Settings File
# This in only a prototype!!!
# After saving in the game the actual settings file will be here:
# Users Homedirectory + '/.lostlaby'
language = english   # english, german, spanish
mydelay  =   200   # Messages    (5 Digits!)
mydelay2 =     0   # Scrolling   (5 Digits!)
mydelay3 =    30   # Mouserefesh (5 Digits!)
mydelay4 =     0   # Animationen (5 Digits!)
joystick = no   # yes, no
no_mouse = no   # yes, no
windowed = no    # yes, no
sound = yes   # yes, no
music = yes   # yes, no
klicking = yes   # yes, no
auto-toggle = no    # yes, no
button5 = no    # yes, no
jars = yes   # yes, no
I would like to improve that. Does anybody here already have a routine to handle (parse) setting files?
Means like ignoring whitespace before and after the values.
Another option would be to transform the settings to an xml file.
What would you guys recommend?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: parse settings file

Post by Trond »

Take a look at the preference library.
eesau
Enthusiast
Enthusiast
Posts: 589
Joined: Fri Apr 27, 2007 12:38 pm
Location: Finland

Re: parse settings file

Post by eesau »

Yes, go with the preferences library. It will make handling settings files a million times easier.
User avatar
IceSoft
Addict
Addict
Posts: 1699
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: parse settings file

Post by IceSoft »

Or use XML.
Belive! C++ version of Puzzle of Mystralia
Bug Planet
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
Post Reply