non-advancing output

non-advancing output

Imagen de reinerb

Hi,
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?
Reiner

publicaciones de 5 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.
Imagen de james@elementyl.com

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

James

Imagen de reinerb

Hi,
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
Imagen de Steve Lionel (Intel)

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.)

Steve

Steve
Imagen de reinerb

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

Inicie sesión para dejar un comentario.