Skip to content

Writing values ​

add ​

fortran
call fini%add(section_name= [, error=])                              ! a section
call fini%add(section_name=, option_name=, val= [, error=])          ! an option, scalar or array val
ArgumentType
section_namecharacter(*), inthe section, '' for the global one; stored without leading and trailing blanks
option_namecharacter(*), inthe option
valclass(*), ina scalar or a rank-1 array of a supported type
errorinteger(I4P), out0, or ERR_OPTION_VALS for a val of a type FiNeR does not support
  • A section that does not exist is created: at the end of the file, or first if it is the global section. An existing section is left as it is.
  • An option that exists in the section is updated in place (its inline comment is kept); a new one is appended to the section. An unsupported val changes nothing.
  • Arrays are written with a blank between items; add has no delimiter argument.

How values are written ​

valWritten asExample
integer, any kinddecimal digits, - for negative numbers only4000, -3
real, any kindthe shortest text that reads back to the same number: plain decimals for exponents from -5 to 15, scientific notation beyond0.1, 0.00005, 6.02214076E+23, -1.0E-12
complex, any kind(re,im), each part as a real(1.5,-0.25)
logicalT or FT
charactera scalar as it is, trailing blanks included (a later load drops them); each item of an array trimmedcopper
arraythe items, one blank between them0.1 0.25 0.4

Every real written by add is read back by get to the same value, huge included. FiNeR uses the compact strings of PENF, without the + of positive numbers.

Deleting ​

fortran
call fini%del(section_name=)                          ! a section and all its options
call fini%del(section_name=, option_name=)            ! one option
call fini%free_options()                              ! every option of every section; the sections stay
call fini%free_options(section_name=)                 ! every option of a section; the section stays
call fini%free_options(section_name=, option_name=)   ! one option (as del)
call fini%free()                                      ! everything, the file name included

Deleting what does not exist does nothing.

Examples ​