non-advancing output

non-advancing output

I'm trying to do non-advancing output from a FORTRAN program (console application) on my terminal (screen). The standard write options for non-advancing output work on files, but not on my terminal. Did anybody solve this already?

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

What exactly are you trying to accomplish, and on what platform(s)?


attached is a sample program which shows my problem. I want to have the output always in the same line, with only the number changing. As it is now, every WRITE statements creates a new line on the screen.
I'm working with Windows 2000 on a Intel P4 system, using Visual Fortran 6.6.

  program nonadvancing 
  integer i,j,jj,jjj,ipercent 
  jj = 10000000 
  do i = 1,100  ! loop  
      do j = 1,jj 
         jjj = j + i 
     end do	 
     ipercent = jjj - jj 
     WRITE(*,'(a,i4,a)') '+ ',ipercent,'% executed ' 
  end do 
  end program nonadvancing

You're not using nonadvancing I/O - that would be if you did a WRITE with ADVANCE='NO' in the control list.

What you have here is Fortran carriage control. The default carriage control interpretation is 'LIST', so the '+' is just another character. You need to have the unit opened with CARRIAGECONTROL='FORTRAN'. Since you are using unit *, the only way to do that is to compile with the option /ccdefault:fortran (this is also under Project..Settings..Fortran..Run-Time Behavior, I think.)


Retired 12/31/2016

Thanks, Steve!
This was the right tip. Just adding the '/ccdefault:fortran' option under "Project .. Settings .. Fortran" solves the problem. There is no need to use the ADVANCE='no' specifier, in fact it is not accepted to add it in the WRITE statement in this context (compiler error).
Thanks again, Reiner

Leave a Comment

Please sign in to add a comment. Not a member? Join today