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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple question

Status
Not open for further replies.

GerritGroot

Technical User
Nov 3, 2006
291
ES
Hi,

Just a simple question.

If I want to avoid the use of ADVANCE='NO' and I want to print a progress bar on the screen going from left to right, why doesn't the following statement work then?

WRITE (*,FMT='(I4,A1)') iperc,'%'
WRITE (*,FMT='(A)')CHAR(8)

As far as I know CHAR(8) should be a backspace


 
The 2nd WRITE starts with a new line but backspace on the start of the line is eq a null action...
 
So if I understand you well it should be

WRITE(*,FMT='(I4,A2)') iperc,'%'//CHAR(8)

That's on the same line but doesn't work either. Netiher does it take away the % sign or some effect like that. It works exactly like:

WRITE(*,*) iperc,'%'
 
You've got a backspace but you haven't overwritten the character. Try
Code:
write(*,'(I4,A3)') iperc, '%' // char(8) // ' '
If that doesn't work, you may have to force it to a printing character. Note that the output may be different on a printer. The printer will probably print the %.
 
No, too bad, it takes away the % sign, but keeps on placing the returns and going to the next line.

What do you mean by "force it to a printing character"?
 
On some systems, printing a space on the screen just moves the cursor. It doesn't blank the character out. If you are printing on the printer it is a different matter. It overwrites it so
Code:
write(*,'(A3)') '\' // char(8) // '/'
will produce an X. On the screen it will just show /

On the older fortran systems with carriage control, this was done with 1H-
 
I found something in the meantime in the web.
It ain't ANSI fortran but anyway, I''l post it here as nearlt all OS'es accept it.

WRITE(*,FMT='(I4,A,$)') iperc,'%'

In stead of $ some exotic systems use \
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top