title: Print immediately on same line on the console screen
body: <p>I'm trying to print some indicator of the progress of long iterations on the console screen. Specifically, I want something like this to be displayed on the console screen:</p>
  
  <pre><code>----|----|----|----|
  </code></pre>
  
  <p>This is, print <code>-</code> after each iteration (not multiple of 5), and print <code>|</code> after each 5 iterations. This is supposed to happen in real time: one character per iteration.</p>
  
  <p>I tried using the <code>WRITE</code> statement with the <code>ADVANCE='NO'</code> option, but the desired output is only displayed on the screen after all the program is executed, or after I use another <code>WRITE</code> statement with an <code>ADVANCE='YES'</code> option.</p>
  
  <p>This is my code:</p>
  
  <pre><code>PROGRAM TEST
  
    IMPLICIT NONE
    INTEGER :: i
  
    DO i = 1,20
       CALL SLEEP(2)
       IF (MOD(i,5).EQ.0) THEN
          WRITE(*,'(A)',ADVANCE='NO'), '|'
       ELSE
          WRITE(*,'(A)',ADVANCE='NO'), '-'
       END IF
    END DO
  
  END PROGRAM TEST
  </code></pre>
  
  <p>I'm using the <code>SLEEP</code> subroutine to simulate the fact that each iteration takes a lot of time.</p>