8000 Taste · szaghi/FiNeR Wiki · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Stefano Zaghi edited this page Mar 31, 2015 · 1 revision

This example demonstrates the some IO feature of FiNeR.

Loading a file
USE Lib_INI_IO
type(Type_File_INI):: fini ! INI File.
call fini%load(source=source)
Creating a file
USE Lib_INI_IO
type(Type_File_INI):: fini ! INI File.
call fini%add(section='sec-foo')
call fini%add(section='sec-foo',option='bar',val=-32.1_R8P)
call fini%add(section='sec-foo',option='baz',val=' hello FiNeR! ')
call fini%add(section='sec-foo',option='array',val=[1,2,3,4])
call fini%add(section='sec-bar')
call fini%add(section='sec-bar',option='bools',val=[.true.,.false.,.false.])
call fini%save(filename='foo.ini')
Introspecting file data
USE Lib_INI_IO
type(Type_File_INI):: fini ! INI File.
...
if (fini%has_section(section='foo')) then
  ! do something with foo
endif
Printing file to stdout
USE Lib_INI_IO
type(Type_File_INI):: fini ! INI File.
...
call fini%print(pref='  ',unit=stdout)

These examples and many others are contained into the ini_autotest procedure. Run the Test_Driver program for checking them.

0