Skip to content

FiNeRFortran INI ParseR

Read, edit and write INI configuration files from modern Fortran, with typed values and no surprises.

FiNeR mark, a section bracket brushed in indigoFiNeR mark, a section bracket brushed in indigo

A tour ​

ini, a command line tool of about 50 lines built on FiNeR (docs/examples/src/tour.f90), lists the sections of a file, reads a value, changes it and saves the file:

An animated terminal session: ini lists the sections of case.ini, reads time.dt, sets it to 5e-5, reads it again, and reports an option that is missing

Quick start ​

f90
call case_file%load(filename='heat.ini', error=error)
if (error /= 0) then
  print '(A,I0)', 'cannot read heat.ini, error ', error
  stop 1
endif
f90
call case_file%get(section_name='grid', option_name='cells', val=cells)
call case_file%get(section_name='grid', option_name='length', val=length)
call case_file%get(section_name='time', option_name='dt', val=dt)
call case_file%get(section_name='time', option_name='steps', val=steps)
call case_file%get(section_name='time', option_name='adaptive', val=adaptive)
call case_file%get(section_name='material', option_name='conductivity', val=conductivity)
call case_file%get(section_name='', option_name='title', val=title)

The tutorial builds a complete program from here, chapter by chapter; the cookbook has a recipe for each everyday task.