PDA

View Full Version : Using ANSI escape characters in Fortran



castiglione
September 14th, 2011, 03:11 AM
Hi - I've been trying to incorporate ANSI escape characters into Fortran but I'm quite at a loss as to how to do so. I've searched around using Google and the methods I've found which use the:

write (*,*) char(27) "[", etc.

method don't seem to work using the Fortran 95 compiler using the straight "f95..." command.

Where am I going wrong?

Thanks in advance!

c

gmargo
September 14th, 2011, 04:12 PM
Can you give an example program that you think should work but doesn't?

Here's a quick-n-dirty test program that compiles and runs with f95.
It prints "Hello Red World!".



PROGRAM test
WRITE(*,'(A,$)') 'Hello '
WRITE(*,'(A,A,$)') char(27),'[31m'
WRITE(*,'(A,$)') 'Red'
WRITE(*,'(A,A,$)') char(27),'[0m'
WRITE(*,'(A)') ' World!'
END PROGRAM test