ANSI.SYS is coming back! (Sort of)

ANSI.SYS is coming back! (Sort of)

Over the years, Visual Fortran users have asked how to get console applications to display color, bold and move the cursor around. "Back in the day", one could do this by loading the driver ANSI.SYS and sending ANSI escape sequences, but that went away after Windows 95. You can do all that stuff with calls to the Windows API console routines, but who wants to do that?

According to this post, a coming update to Windows 10 completely overhauls the console environment, adding support for many ANSI (and VT100) escape sequences. Looks like fun!

Retired 12/31/2016
6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

How can/should/will an Intel Fortran program determine whether OUTPUT_UNIT refers to a console with escape sequence support, or a file (or - what's the equivalent of isattty)?  An extension to INQUIRE?
 

I have no idea. You may just have to base it on a detailed Windows version check. Perhaps there will be an API for asking details on console support.

Retired 12/31/2016

Maybe I'm getting ahead of things.  I was thinking more around redirection of standard output, rather than operating system capability (though the latter is perhaps more significant).  You see unix terminal programs varying their behaviour on the basis of whether they are running in an [interactive] terminal or with their input/output redirected to a file or pipe - `myprogram.exe` versus `myprogram.exe > some_file.txt` - you don't want to be writing a whole lot of escape codes to a flat text file.

Perhaps it is a case of checking whether the program's GetStdHandle output handle (assuming `WRITE (OUTPUT_UNIT...` always ends up writing to that?) works with the Console API.  Not sure.

It is only tangent to the current discussion, but there is a nice little project on SourceForge which would help: http://foul.sourceforge.net/

 

Quote:

ianh wrote:

How can/should/will an Intel Fortran program determine whether OUTPUT_UNIT refers to a console with escape sequence support, or a file (or - what's the equivalent of isattty)?  An extension to INQUIRE?
 

Hello

Long time ago, I remember that I performed a check to test whether ansi.sys was activated or not.

If you are interested, I will search back in my archives to find this test.

Leave a Comment

Please sign in to add a comment. Not a member? Join today