I wanted to use automatic integer width descriptor in fortran 90. I referred to Output formatting: too much whitespace in gfortran
This question says that I can use I0 and F0,0 for "auto" width.
Here is my sample code (complied with GNU Fortran Compiler):
PROGRAM MAIN
IMPLICIT NONE
INTEGER :: i
REAL :: j
WRITE (*,*) 'Enter integer'
READ (*,100) i
100 FORMAT (I0)
WRITE (*,*) 'Enter real'
READ (*,110) j
110 FORMAT (F0.0)
WRITE (*,100) 'Integer = ',i
WRITE (*,110) 'Real = ',j
END PROGRAM
There is runtime error (unit = 5, file = 'stdin')
Fortran runtime error: Positive width required in format
Am I mis-understanding the auto width descriptor? What option should I use?
read(*,*)) - agentpI0on input" to a focused question was sensible. - francescalusI0descriptor was added to the Fortran standard in the Fortran 95 revision - Fortran 90 (section 10.2.1) requires the width of the integer edit descriptor to be positive. - jme52