At 13:57 28-01-2004 -0800, Richard wrote:
>Renchi Raju writes:
> > On Wed, 28 Jan 2004, Richard Maine wrote:
> > > C doesn't have such a thing either...for the same reason as Fortran.
>
> > you might be right, but gcc printf/fprintf with "\r" (followed by a flush)
> > produces expected results. (i just tested it with intel c compiler and
> > works there too)
>
>And you can do exactly the same thing in Fortran. This isn't
>a feature of the C language. This is just a feature of (some)
>terminals.
>
>If that works in C, then so will
>
> write(lun,'(a1)',advance='no') achar(13)
>
>because both do exactly the same thing - write an ascii carriage
>return. That was one of the options I mentioned. It will
>probably work, but it is hardware-dependent - not part of
>Fortran (or C). Neither language says anything about what this
>will do to a terminal.
>
>--
>Richard Maine | Good judgment comes from experience;
>[log in to unmask] | experience comes from bad judgment.
> | -- Mark Twain
I found out some time ago, that the following gives the desired
result with three compilers:
Absoft, Salford, NA Software
on my Win XP screen.
! [JvO] 2002-08-30 D:\Fortran\Test\NonadvCR.f95
! Printing repeatedly on the same line
program test_io
implicit NONE
integer :: i, j
real :: x(1000)
character :: c(0:3) = (/ char(196), "\", "|", "/" /)
call random_number(x)
print *, x(1:2), x(99:100)
do i = 1, 20
do j = 1, 1500 ! To pass the time if no SLEEP available
call random_number(x)
end do
! call sleep(1) ! [Absoft] Unix.lib -aliases:unicode.als
! call sleep@(0.99) ! [Salford]
write( * &
& , "((a1, t4, i3, 'e R:', F10.5, ' .-.-.-. ', a1))" &
& , advance = "NO" &
& ) char(13), i, x(i), c(mod(i,4))
end do
end program test_io
\---
Best regards,
Jan van Oosterwijk | "They that can give up essential liberty
Netherlands | to obtain a little temporary safety deserve
| neither liberty nor safety."
| -- Benjamin Franklin (1759)
write(*,*)transfer((/778985834,1869504886,1702130543,1785296754 &
&,1635205227,1868849518,1819160175 /),(/'x'/)) ; end
mailto:Jan<dot>vanOosterwijk<at>wanadoo<dot>NL
http://huizen<dot>dto<dot>tudelft<dot>nl/vanOosterwijk/
|