title: Read(*,*) causes (unit = 5, file = 'stdin') Fortran runtime error: End of file
body: <p>I am trying to make a small code snippet in Fortran 90 to read in a file name from the user, and I know that it should be simple, but I just can't figure out what I'm doing wrong.</p>
  <p>The script is:</p>
  <pre class="lang-pascal prettyprint-override"><code>program test
    implicit none
    Character (Len = 15) :: filename
  
    Write(*,*) 'Input file name'
    Read(*,*) filename
    Write(*,*) 'So the file is called',filename
  end program test
  </code></pre>
  <p>And then I compile it on an ubuntu system using gfortran:</p>
  <pre><code>$ gfortran test.f90 -o test.exe
  </code></pre>
  <p>It compiles fine, but when I run <code>./test.exe</code>, I get the following output:</p>
  <pre class="lang-sh prettyprint-override"><code>$ ./test.exe 
  Input file name 
  At line 6 of file test.f90 (unit = 5, file = 'stdin') 
  Fortran runtime error: End of file 
  
  Error termination. Backtrace:
  #0  0x7f435e83b32a 
  </code></pre>
  <p>when what I was expecting to get was:</p>
  <pre class="lang-sh prettyprint-override"><code>$ ./test.exe 
  Input file name 
  [program pauses while user inputs text] 
  So the file is called [text the user inputted]
  </code></pre>
  <p>I just can't seem to find an example of this error or how to fix it online. Can someone please tell me where I'm going wrong here?</p>