reading configuration files
- From: Bart Vandewoestyne <MyFirstName.MyLastName@xxxxxxxxxx>
- Date: Wed, 18 Feb 2009 09:48:03 GMT
Hello all,
In an attempt to make a certain program more flexible in its use,
I would like it to read certain parameters from a textual
configuration file.
For as far as I can see now, the program parameters are all
simple scalar values, so I was wondering what could be the best
format for my configuration file, with respect to readability,
ease of reading in the values in my program and also taking into
account that the people who are entering the values in the
text-files do not know much about Fortran programming.
Some ways of doing it could be for example:
Option 1: use one space
----------------
parameter1 value1
parameter2 value2
Option 2: use :
---------------
parameter1:value1
parameter2:value2
Option 3: use tabs
------------------
parameter1 value1
parameter2 value2
Option 4: use two lines for parameter-value pairs
-------------------------------------------------
parameter1
value1
parameter2
value2
Option 5-...: any other suggestions?
------------------------------------
???
The names 'parameter1' and 'parameter2' do not necessarily have
to be the same length, and also I do not want to make many
assumptions on the input format of the numerical values (say I have
non-fortran users that need to modify the text-files and write
numerical values in it... so they don't know anything about
format descriptors etc...)
What would be a good format for my configuration files so that
i can easily read it in my fortran code and so that it is a bit
robust against different formats for the numerical values.
(e.g. a user could enter 1.0e3 or 1000 or 1000.0.
Thanks,
Bart
--
"Share what you know. Learn what you don't."
.
- Follow-Ups:
- Re: reading configuration files
- From: Dan
- Re: reading configuration files
- From: baf
- Re: reading configuration files
- From: David Jones
- Re: reading configuration files
- From: Joseph Huber
- Re: reading configuration files
- From: Ian Bush
- Re: reading configuration files
- Prev by Date: Re: Host Association and DO Index Variables
- Next by Date: Re: reading configuration files
- Previous by thread: A main program error!
- Next by thread: Re: reading configuration files
- Index(es):
Relevant Pages
|