title: Write in an existing file without overwriting in Fortran
body: <p>I have an existing file written by a Fortran program (formatted) and I would like to add few lines at the beginning of the file. The idea is to do so without making a copy of the original file.</p>
  
  <p>I could add a line at the end of the file with:</p>
  
  <pre><code>open(21,file=myfile.dat,status='old',action='write',
          form='formatted',position="append")
  write(21,*) "a new line"
  </code></pre>
  
  <p>but when I tried:</p>
  
  <pre><code>open(21,file=myfile.dat,status='old',action='write',
          form='formatted',position="rewind")
  write(21,*) "a new line"
  </code></pre>
  
  <p>it overwrites the whole file.</p>
  
  <p>It might be impossible.
  At least, I would be glad to have a confirmation that it is effectively impossible.</p>