Parsing INI configuration files with FORTRAN

Fortran would not be my first choice for working with text, in any form! However, sometimes even numerical codes need to read data from configuration files. The easiest way to read a configuration file from a Fortran 90 routine is by using namelist I/O (I really need to add an example of that). If you’re stuck with INI files, I found an INI file parser written in Fortran buried in an index of free Fortran routine.  I don’t even remember how I even found it, since it’s not well labeled and doesn’t come up in the first few pages of Google results, so I thought I’d better write a post about it in case I ever need such a thing in the future.

Advertisements

2 thoughts on “Parsing INI configuration files with FORTRAN

  1. When designing configuration files, it is in my opinion a good idea to use something scriptable like Lua, this provides a great deal of flexibility and readability. To read Lua scripts in Fortran applications as configuration files, we created a small library at https://bitbucket.org/haraldkl/aotus/overview so this might be of interest to you, if you ever run across the need for config files, which do not have to be INI files.

    Like

  2. Thanks for the tip, Harald! Your library looks like a good choice for any configuration files that are too complicated to be handled with namelist I/O.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s