- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm trying to show the progress of my program. It looks like:
0.0/100 %
1.0/100 %
2.0/100 %
3.0/100 %
4.0/100 %
...
99.0/100 %
100.0/100 %
My problem is: I don't know a nice way to return the cursor back and rewrite the last line. I want to know if is there a way to return to last printed line, clear it and rewrite again.
I know how to do it using system("clear"). But it erases other messages...
Thank you
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As Ron says, there is no standard way to do it. But you can do some tricks with extensions. For example:
[plain]open (unit=6,carriagecontrol='fortran') do i=1,10 write (6,'($,A,A,i2)') '+',char(13),i end do[/plain]
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - brunocalado
Hi,
I'm trying to show the progress of my program. It looks like:
0.0/100 %
1.0/100 %
2.0/100 %
3.0/100 %
4.0/100 %
...
99.0/100 %
100.0/100 %
My problem is: I don't know a nice way to return the cursor back and rewrite the last line. I want to know if is there a way to return to last printed line, clear it and rewrite again.
I know how to do it using system("clear"). But it erases other messages...
Thank you
There is no standard Fortran method for doing what you want to do - to update a terminal output on the same line.
In the old days, we had control codes for VT100/VT220 terminals that would allow such a thing - but this was not standard Fortran. Rather, you send the control codes/sequences that were unique to those terminals to explicitly control the output location. I don't know of a way to do that for terminal windows - and then terminal windows are not consistent across different OSes.
ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As Ron says, there is no standard way to do it. But you can do some tricks with extensions. For example:
[plain]open (unit=6,carriagecontrol='fortran') do i=1,10 write (6,'($,A,A,i2)') '+',char(13),i end do[/plain]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
As Ron says, there is no standard way to do it. But you can do some tricks with extensions. For example:
[plain]open (unit=6,carriagecontrol='fortran') do i=1,10 write (6,'($,A,A,i2)') '+',char(13),i end do[/plain]
Thank you. You're the best!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page