text color

I

ivan

Hi all,

what is the name of the function to change the text color when programming
in C under msdos?

thanks
ivan
 
R

Robert Riebisch

ivan said:
VC++ Express..

You can't do DOS in Visual C++ Express!

You are probably talking about a command line window. That's not DOS!
You are off-topic here.
 
R

Richard Heathfield

Robert Riebisch said:
You can't do DOS in Visual C++ Express!

Yes, you can. You can use Visual C++ Express to write a DOS clone, no
problem.

What you can't do is Visual C++ Express in DOS. And Visual C++ Express does
not allow you to target DOS directly. (Obviously, you could use it to write
a *program* that generates a 16-bit executable! But Visual C++ won't do it
itself.)
You are probably talking about a command line window.

Ah, now you have me. Yes, probably he is...
That's not DOS!

....and probably it isn't. (It might be - he could be running a DOS
emulator...)
You are off-topic here.

....and here!
 
M

Mark McIntyre

Hi all,

what is the name of the function to change the text color when programming
in C under msdos?

This is a FAQ.

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
M

mcalhoun

what is the name of the function to change the text color when programming
You can use ANSI escape sequence codes

That's the way I do it, and it's programming-language independent.
If the "escape" characters make it -- the FIRST line should be
^[ (as one character) followed by [2J and so on -- you can TYPE
the following stuff (between the "cut here" lines) to see what
ANSI can do for you. (And if the escape characters do NOT make
it, let me know and I'll substitute some character that WILL
make it through and you can re-substitute back to the escapes.)

---------- cut here ---------- cut here ---------- cut here ----------

Normal Red on black Normal Green on black
High Red on black High Green on black
 Grey on black Normal Blue on black is not very readable
 White on black High Blue on black
 Orange on black Normal Magenta on black
 Yellow on black High Magenta on black
Normal Cyan on black High Cyan on black High Cyan on grey

+-0 = White on black ("Normal") [same as Low]
| 1 = High-intensity text
ESC[xm Screen INTENSITY: x=+ 2 = Low -intensity text [same as "Normal"
+-0 = Black | 5 = Blink or high-intensity background [bright!]
| 1 = Red | 7 = Inverse (black on white) [nope]
| 2 = Green +-8 = Invisible text (fore- & back-ground same)
ESC[3x;4ym COLOR:+ 3 = Orange [nope]
| 4 = Blue These can be combined:
x=foreground | 5 = Magenta ESC[1;5m = hi-intensity blinking foreground
y=background | 6 = Cyan ESC[1;2;31;42m etc.
+-7 = White
---------- cut here ---------- cut here ---------- cut here ----------

--Myron.
 
K

kondal

You can use ANSI escape sequence codes

That's the way I do it, and it's programming-language independent.
If the "escape" characters make it -- the FIRST line should be
^[ (as one character) followed by [2J and so on -- you can TYPE
the following stuff (between the "cut here" lines) to see what
ANSI can do for you. (And if the escape characters do NOT make
it, let me know and I'll substitute some character that WILL
make it through and you can re-substitute back to the escapes.)

---------- cut here ---------- cut here ---------- cut here ----------

Normal Red on black Normal Green on black
High Red on black High Green on black
 Grey on black Normal Blue on black is not very readable
 White on black High Blue on black
 Orange on black Normal Magenta on black
 Yellow on black High Magenta on black
Normal Cyan on black High Cyan on black High Cyan on grey

+-0 = White on black ("Normal") [same as Low]
| 1 = High-intensity text
ESC[xm Screen INTENSITY: x=+ 2 = Low -intensity text [same as "Normal"
+-0 = Black | 5 = Blink or high-intensity background [bright!]
| 1 = Red | 7 = Inverse (black on white) [nope]
| 2 = Green +-8 = Invisible text (fore- & back-ground same)
ESC[3x;4ym COLOR:+ 3 = Orange [nope]
| 4 = Blue These can be combined:
x=foreground | 5 = Magenta ESC[1;5m = hi-intensity blinking foreground
y=background | 6 = Cyan ESC[1;2;31;42m etc.
+-7 = White
---------- cut here ---------- cut here ---------- cut here ----------

--Myron.
--
--Myron A. Calhoun.
Five boxes preserve our freedoms: soap, ballot, witness, jury, and cartridge
NRA Life Member and Rifle, Pistol, & Home Firearm Safety Certified Instructor
Certified Instructor for the Kansas Concealed-Carry Handgun license

Please don't snip attribution lines. I learnt the meaning/reason from
Keith Thompson once.

-kondal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top