Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

twirly thing

Status
Not open for further replies.

rih5342

Marine/Ocean
Joined
May 8, 2007
Messages
40
Location
US
I'm a new user of gfortran and am wondering how you implement
a non-advancing write.

The following code fragment works fine under IVF.

CLOSE(UNIT=6)
OPEN(UNIT=6, CARRIAGECONTROL='FORTRAN')
DO I = 1, 1000
WRITE(6, 10) '/'
WRITE(6, 10) '-'
WRITE(6, 10) '\'
ENDDO
10 FORMAT('+',2A)
CLOSE(UNIT=6)
OPEN(UNIT=6, CARRIAGECONTROL='LIST')

Thank you.
 
Try something like this
Code:
program main
   character(len=1):: bksp
   
   bksp = char(8)
   do ii = 1, 2000
      write(*, 10, advance='no') '/', bksp
      write(*, 10, advance='no') '-', bksp
      write(*, 10, advance='no') '\', bksp
      write(*, 10, advance='no') '|', bksp
   10 format(2A)
   end do
end program main
This loop finishes in no time so you might want to think of some sort of delay in between the writes
 

Backspace, Duh!!!

Working now thank you.

! **********************************************************************
SUBROUTINE DELAY(INC)
! **********************************************************************
! INC - NUMBER OF 1/1000'S OF A SECOND DELAY
! ----------------------------------------------------------------------
IMPLICIT NONE
integer, intent(in) :: inc
INTEGER ITIME, ITIME0
integer, dimension(8) :: time_array

call date_and_time(values=time_array)

itime0 = time_array(5) * 3600000 + & ! hour
time_array(6) * 60000 + & ! minute
time_array(7) * 1000 + & ! second
time_array(8) ! milli second

do

call date_and_time(values=time_array)

itime = time_array(5) * 3600000 + & ! hour
time_array(6) * 60000 + & ! minute
time_array(7) * 1000 + & ! second
time_array(8) ! milli second

IF(ITIME >= ITIME0+INC) exit

enddo

END SUBROUTINE DELAY
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top