I have a text file with two numbers on the same line
108 6.7522
I have a fortran subroutine READCN that stores the numbers 108 6.7522 from the text file into the variables NN and BOX
SUBROUTINE READCN ( CNFILE, BOX )
CHARACTER CNFILE*(*)
REAL BOX
INTEGER CNUNIT
PARAMETER ( CNUNIT = 10 )
INTEGER NN
OPEN ( UNIT = CNUNIT, FILE = CNFILE, STATUS = 'OLD',
: FORM = 'UNFORMATTED' )
READ ( CNUNIT ) NN, BOX
WRITE(*,*) NN, BOX
CLOSE ( UNIT = CNUNIT )
RETURN
END
The output for READCN variables NN BOX is
3.2997999 2.74554597E-31
How do I read the values correctly?
This program is taken from http://www.ccl.net/cca/software/SOURCES/FORTRAN/allen-tildesley-book/f.12
When I attempted to remove the format option in the read command this was the follow error I received
At line 686 of file MCNPT.f (unit = 10, file = 'LATTICE-256.txt')
Fortran runtime error: Missing format for FORMATTED data transfer
form='unformatted'in theopenstatement"? - francescalus