[Q] Write file and check it while the program runs

From: Jaegu Lee (gulee_at_postech.ac.kr)
Date: 06/18/04


Date: Fri, 18 Jun 2004 15:49:15 +0900

Hello, everybody

I have a question.
I would like to check the result while the program runs.
But I found that if 'CLOSE' is not excuted, the writing file is empty.
So, If the result does not converge, I can not get the output file.

main.f90==================================================
OPEN( UNIT=1, FILE="TEMP", STATUS="REPLACE")
DO ( until the result converges )
  WRITE(1,*) results
ENDDO
CLOSE(1)
=========================================================

so I coded like below.

main.f90==================================================
OPEN( UNIT=1, FILE="TEMP", STATUS="REPLACE")

CLOSE(1)
DO ( until the result converges )
  OPEN( UNIT=1, FILE="TEMP", STATUS="OLD", POSITION="APPEND" )
  WRITE(1,*) results
  CLOSE(1)
END DO
=========================================================

I'm wondering if there is any other way to check the writing file, and
if the OPEN statement in DO loop affects the speed of the program.

OS:Redhat 7 , Compiler : lf95


Quantcast