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.

2 thoughts on “Parsing INI configuration files with FORTRAN

  1. haraldkl

    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.

    Reply
  2. craig Post author

    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.

    Reply

Leave a Reply