I couldn't figure out what's wrong with the following Fortran OPEN statement:
filename = 'state_save.txt'
OPEN(FILE=TRIM(dir)//TRIM(filename),UNIT=ffunit,STATUS='old',FORM='formatted',
IOSTAT=ios, readonly)
[I added CR for clarity]
Compiled under gfortran (from gcc-4.8.1), the above gives the following error:
(dir)//TRIM(filename),UNIT=ffunit,STATUS='old',FORM='formatted',IOSTAT=ios, rea
1
Error: Syntax error in OPEN statement at (1)
The code might compile OK with ifort (but I don't have ifort).
Can someone please explain what went wrong and how to write the statement in a standard compliant way?