且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将FORTRAN READ参数传递给字符串

更新时间:2021-12-13 22:40:58

您可以查看"NAMELIST" I/O,这也许是您要执行的操作.通常,名称列表IO会遇到各种问题,并且人们经常反而会编写自己的自定义IO例程.但是,如果满足您的需求就足够了,那么它就很容易使用.例如

You can look into "NAMELIST" I/O, which maybe does what you're after. Often, namelist IO has various issues, and people often resort to writing their own custom IO routines anyway. But if it's enough for what you want, it's quite easy to use. E.g.



program nmltest
  implicit none
  real :: x
  integer :: y
  namelist /mynml/ x, y
  x = 4711
  y = 42
  write(*, mynml)
end program nmltest