Read a configuration file

From Rosetta Code
Revision as of 21:32, 10 February 2011 by rosettacode>Markhobley (initial draft)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Read a configuration file is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

The task is to read a configuration file in standard configuration file, and set variables accordingly. For this task, we have a configuration file as follows:

  1. This is a configuration file in standard configuration file format
  2. Lines that begin with a hash symbol or semicolon are treated as
  3. comments and will be ignored
  1. This is the fullname parameter

FULLNAME Foo Barber

  1. This is a favourite fruit

FAVOURITEFRUIT banana

  1. This is a boolean that should be set

NEEDSPEELING

  1. This boolean is commented out
SEEDSREMOVED


For the task we need to set four variables according to the configuration entries as follows:

fullname = Foo Barber favouritefruit = banana needpeeling = true seedsremoved = false