This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Overwriting lines
- From: Tobias Burnus <burnus at net-b dot de>
- To: Rahul Gupta <rahul at physto dot se>
- Cc: fortran at gcc dot gnu dot org
- Date: Fri, 06 Nov 2009 20:36:42 +0100
- Subject: Re: Overwriting lines
- References: <4AF475A1.8060407@physto.se>
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