Fortran 90 Replace Text on Screen - Andy's Question

  • Fortran
  • Thread starter Choragos
  • Start date
  • Tags
    Fortran
In summary, Fortran used to allow you to replace text on the screen with different text, but that was removed in Fortran 90.
  • #1
Choragos
20
0
Hello. In producing screen output from Fortran, I use the write statement. Back in the day, there was a way to use the FORMAT statement to allow you to replace text on the screen with different text. For example, counting up percentage complete of a process or something like that.

Well, Fortran 90 put the nix on that and now I don't know how to do it. For all of us who don't want to let go of our DOS prompts (or who sit in Linux command lines), is there a way to accomplish this task?

Thanks
Andy
 
Technology news on Phys.org
  • #2
I've never heard of this. What was the procedure to do it in previous versions?
 
  • #3
It was buried in the FORMAT statement. I believe this is how it was done (I had to change the code and I believe this was the original version):

15 format('+Processing decay number ',I6)

I believe it's that '+' sitting there. If that doesn't make any sense I'll go on the hunt and make sure this is the original version.
 
  • #4
  • #5
If I'm not mistaken, that only prevents advancement to the next line; it does not overwrite what is already there. I'll check it though and post results. Thanks!
 
  • #6
Sorry I didn't see you post before sending out mine.
The '+' character was used for printer control in the good old days where we have a $35000 line printer but no screen. The printer control will simply be displayed on the screen but won't halt the advance of the cursor. See post #4 for details.
 
  • #7
To move the cursor horizontally, you could use the T-descriptor (tab).
The T-descriptor goes to the absolute column, while the TL and TR moves the cursor to the left or the right (relative movement) respectively.
Try:
http://docs.hp.com/en/B3908-90002/ch09s03.html#d0e22660
 
Last edited by a moderator:
  • #8
That looks like it will do it. Thank you.
 
  • #9
If you got it to work, then let me know how you did. I wrote a quick sample program
Code:
PROGRAM test

do i=1,10
 WRITE(6,999,ADVANCE='NO') i
END DO

999 FORMAT(TL2I2.2)

END PROGRAM
Which outputs
Code:
01020304050607080910:~>
TRn and Tn both seem to skip the wrong way. I can't figure out how to overwrite.

p.s. Good fortran reference though
 
  • #10
Indeed, it isn't overwriting for me either. I'm using

10 FORMAT(TL2I2)

and

10 FORMAT(T1I2).

The formatting is working, except that T will not move the cursor back over what has been written. It will advance, but not go back.

Edit: by the way, I'm using both Intel and gfortran compilers.
 
  • #11
Indeed, it does not work between writes. It works only within the buffer, i.e. before the write statement is executed. So it doesn't do what you need to do.
It looks to me that you'll need some system calls, which unfortunately will be platform dependent. I know it is possible with Borland C which has a set of routines (conio.h) for that purpose. You may want to check out the versions of Fortran you're using to see if some equivalent library exists.
Another possibility is if your have called c-libraries before, you may want to take advantage of that.
Sorry folks, good try, but do post back if you find something. This will benefit everyone.
 

Related to Fortran 90 Replace Text on Screen - Andy's Question

1. What is Fortran 90 Replace Text on Screen and how does it work?

Fortran 90 Replace Text on Screen is a feature in the Fortran 90 programming language that allows you to replace text on the screen with other text. It works by using the "replace" command, which takes in the old text and the new text as inputs and replaces all instances of the old text with the new text on the screen.

2. Can Fortran 90 Replace Text on Screen be used in any type of program?

Yes, Fortran 90 Replace Text on Screen can be used in any type of program as long as it is written in the Fortran 90 language. This feature is not limited to any specific type of program.

3. Is Fortran 90 Replace Text on Screen a built-in function or do I need to import a library?

Fortran 90 Replace Text on Screen is a built-in function in the Fortran 90 language. This means that you do not need to import any external libraries or modules to use this feature.

4. Can I replace multiple instances of text on the screen at once with Fortran 90 Replace Text on Screen?

Yes, you can replace multiple instances of text on the screen at once with Fortran 90 Replace Text on Screen. The "replace" command will replace all instances of the old text with the new text on the screen.

5. Are there any limitations or restrictions when using Fortran 90 Replace Text on Screen?

There are no specific limitations or restrictions when using Fortran 90 Replace Text on Screen. However, it is important to note that this feature will only work on text that is currently displayed on the screen and it will not modify any underlying data or variables.

Similar threads

  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
12
Views
1K
  • Programming and Computer Science
Replies
16
Views
3K
  • Programming and Computer Science
Replies
2
Views
2K
  • Programming and Computer Science
Replies
9
Views
4K
  • Programming and Computer Science
Replies
4
Views
4K
  • Computing and Technology
Replies
3
Views
2K
  • Programming and Computer Science
Replies
3
Views
3K
  • Programming and Computer Science
Replies
19
Views
6K
  • Programming and Computer Science
Replies
4
Views
3K
Back
Top