Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

ANSI.SYS is coming back! (Sort of)

Steven_L_Intel1
Employee
478 Views

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!

0 Kudos
5 Replies
IanH
Honored Contributor II
478 Views

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?
 

0 Kudos
Steven_L_Intel1
Employee
478 Views

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.

0 Kudos
IanH
Honored Contributor II
478 Views

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.

0 Kudos
Arjen_Markus
Honored Contributor I
478 Views

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

 

0 Kudos
GVautier
New Contributor II
478 Views
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.
0 Kudos
Reply