This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Overwriting lines


Am 06.11.2009 20:14, schrieb Rahul Gupta:
> I want to overwrite a line on screen. Whether I use "$" or
> advance="no" with a TL (TR works fine, with the origin at whichever
> column the previous line ended) statement of use "+" as my first
> character, I am only able to write from where the previous line
> finished or next line.

I think the Fortran standard provides no way to do this. Additionally,
it is also not possible if you write for instance into a pipe of another
program. However, with most terminals, doing a carriage-return ('\r')
should work. As you will see, you need to take care yourself that you
clean up the line.

implicit none
intrinsic sleep
integer :: i
do i = 0, 100,17
  write(*,'(a,i3,"%",a)',advance='no') &
             'Performing nothing: ', i,achar(13)
  call sleep(1)
end do
write(*,*) 'DONE '   ! << have a look at the output
end

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]