Re: Formatted output, overwrite



Jason Nielsen wrote in message ...
|I've been trying to get my Fortran program to overwrite some output. For
|example I want my program to write:
|
|Updated solution: 12.334
|
|where here 12.334 is the solution. Then as the program runs I want to
|overwrite the value 12.334 with the new updated value. Here is a test
|program that obviously doesn't do what I want:
|
|program test
| implicit none
| character(len=*), parameter:: form1="(A20,1X,F12.3)"
| integer:: i
| real:: rn
| call random_seed()
| call random_number(rn)
| rn=100.0*rn
| write(*,form1) 'M-updated solution :', rn
| do i=1,10
| call random_number(rn)
| rn=100.0*rn
|! backspace(unit=*)
| write(*,'(F12.3)',advance='no') rn
| end do
|end program test
|
|There must be a simple way of doing this but for the life of me I can't
|figure it out. Thanks for any help.

Try sending a reverse line feed and M, without advance='no'

|Cheers,
|Jason


.