title: Fortran: assigning a value from a text file to a variable
body: <p>We have recently started lectures on fortran in Uni and our lecturer has very limited time to actually explain something. So since I have never had any experience with that programming language I am struggling on some of the problems. In particular the whole idea of <em>formats</em>. I am trying to assign a value to a variable from a text file.</p>
  
  <pre><code>program interpolation
  
  implicit none
  integer :: i,N
  real :: T1,Hfg1,T2,Hfg2,T,Hfg
  !-------------------------------------
  open(20,file='values.txt')
  !Input temperature to be interpolated
  print*,'Input temperature to be interpolated'
  read(*,*) T
  !Read number of values from file
  read(20,1000) N
  1000 format(I5)
  </code></pre>
  
  <p>The code goes on from here, but what I am really struggling to understand is the whole format concept. The way I see it is that I open a file '<strong>values.txt</strong>' and assign <strong>unit 20</strong> to it, so whenever I call unit 20 I am refering to that file. Right ? After that I ask the user to input some initial value for T. Doesn't really matter. Now after that I read a value from the unit=20 file assign to a variable <strong>N</strong>. Now what does digit <strong>1000</strong> mean ? And what is the purpose of the next step, '<strong>1000 format(I5)</strong>' ? As far as I understand '<strong>I5</strong>' means Integer with max number of characters of 5 ? Or am I wrong?</p>