Software Archive
Read-only legacy content
17061 Discussions

non-advancing output

reinerb
Beginner
856 Views
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
0 Kudos
4 Replies
james1
Beginner
856 Views
What exactly are you trying to accomplish, and on what platform(s)?

James
0 Kudos
reinerb
Beginner
856 Views
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
0 Kudos
Steven_L_Intel1
Employee
856 Views
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
0 Kudos
reinerb
Beginner
856 Views
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
0 Kudos
Reply