Color in Visual C++ 6.0
Posted: Sun Nov 14, 2004 8:24 am
I've seen some posts about using color in C++ and have read a bit about it but I'm still lost. Just to be clear, I am working on creating DOS programs. I have seen a DOS program created solely by C++ generate color so I know it can be done.
I read somewhere that you need to include the graphics.h file. Unfortunately, if you look in the library of header files included with Visual C++, the graphics.h file is not there. I also have an old Borland C++ compiler () and it actually does have the graphics.h file.
The command you're supposed to use to change the color, according to what I've read, is setcolor(<colorvalue>). Well I made a simple little program in Borland where I included graphics.h and a command to change the color. When I tried to run it, I got an error relating to the header file. It was saying something about how it wouldn't work w/ windows. I make DOS programs but they run through a command prompt window in windows. Do I have to find a compiler that works in DOS to do this??? Also, can somebody please give me a sample code to change the text color and background color in a DOS program (and address my header file issues)?
I read somewhere that you need to include the graphics.h file. Unfortunately, if you look in the library of header files included with Visual C++, the graphics.h file is not there. I also have an old Borland C++ compiler () and it actually does have the graphics.h file.
The command you're supposed to use to change the color, according to what I've read, is setcolor(<colorvalue>). Well I made a simple little program in Borland where I included graphics.h and a command to change the color. When I tried to run it, I got an error relating to the header file. It was saying something about how it wouldn't work w/ windows. I make DOS programs but they run through a command prompt window in windows. Do I have to find a compiler that works in DOS to do this??? Also, can somebody please give me a sample code to change the text color and background color in a DOS program (and address my header file issues)?