pass FORTRAN READ arguments into a string -
i have string including names of variables want read, , pass string read function. allow me change name of variables read changing vector names of variables. example be:
program test implicit none integer :: no, age character(len=20) :: myname, vars vars='no, myname, age' read(*, '(i4,a20,i4)') vars print*, no, myname, age end program test is possible?
you can "namelist" i/o, maybe you're after. often, namelist io has various issues, , people resort writing own custom io routines anyway. if it's enough want, it's quite easy use. e.g.
program nmltest implicit none real :: x integer :: y namelist /mynml/ x, y x = 4711 y = 42 write(*, mynml) end program nmltest
Comments
Post a Comment