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

Text colors in console application?

jparsly
New Contributor I
505 Views
I am attempting to convert an old 16 bit Fortran program to run
in CVF. It used a small number of assembler routines to provide
the ability to read direction keys, and to print characters at a specific row and column on the screen. A console project seems like it would be the
easiest conversion path, and I've found routines that provide
most of what I need (PEEKCHARQQ, GETCHARQQ, and
SetConsoleCursorPosition). I can't find any way to control the
foreground and background color used to print a character. It looks like
you can do this in a QuickWin application, but I'm afraid that this will
cause complications with the character trapping that I'd just as soon not
fool with. Is there a way to set the colors used for text in a console application?
0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
505 Views
SetConsoleTextAttribute
0 Kudos
Steven_L_Intel1
Employee
505 Views
Use GetStdHandle( STD_OUTPUT_HANDLE) to get the handle for the console.
0 Kudos
Reply