TC textcolor(RED) problem
Steve Resnick
stever at Octopus.COM
Fri Mar 30 10:29:05 AEST 1990
In article <1990Mar28.224220.16285 at xenitec.on.ca> timk at xenitec.UUCP (Tim Kuehn) writes:
>This is annoying - I want to display text on my VGA screen in different
>colors. Supposedly the following Turbo C code segment should show me
>a red 'hello' on the screen. It doesn't, but shows me the text in the current
>default color instead:
>
>#include <stdio.h>
>#include <conio.h>
>#include <dos.h>
>
>main()
>{
>textcolor(RED);
>printf("hello\n");
>}
>
I'm not sure how textcolor sets the video attribute, whether it's set in
a variable in the conio library or if it actually changes the screen attributes
at the same time. Either way, the ANSI driver is oblivious to this change (where
printf's out put is going) the correct sequence would be:
#include <conio.h>
main()
{
textcolor(RED);
cprintf("This oughta work\r\n"); (the \r is needed since this is RAW IO)
}
Hope this helps....
More information about the Comp.lang.c
mailing list