Is there a way to get text color with Win32? You can't get it with textcolor in conio.h cuz it's not compatible (for some reason )
Is there a way to get text color with Win32? You can't get it with textcolor in conio.h cuz it's not compatible (for some reason )
Stupid people are useful. You can make them do all the mindless tasks you are too lazy to do yourself.
Sphynx cats are just bald and wrinkly, like old people, and we don't reject them.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
[sarcasm]oh that helps[/sarcasm]
im still pretty much a beginner and need something pretty basic.
EDIT:
I checked out the FAQ and I guess that is the only way to do it. man...that smells.
Last edited by MMD_Lynx; 09-01-2004 at 03:15 PM.
Stupid people are useful. You can make them do all the mindless tasks you are too lazy to do yourself.
Sphynx cats are just bald and wrinkly, like old people, and we don't reject them.
conio.h was made for DOS (which doesnt run in a win32 enviroment). What you are looking for is a way to change the console text color.
Check out the function SetConsoleTextAttribute(). You can do Google searches for code examples. Microsoft also has an example in the Console SDK.
There is a conio.c file offered with the Dev-C++ suite, that implements most of the conio function for Windows Console mode.Originally Posted by MMD_Lynx
Emmanuel Delahaye
"C is a sharp tool"
Try this function (don't forget to #include <windows.h>):
I may have fore and back reversed but I don't remember since it's been a while since I used C and I don't have a way to test it.Code:void setcolor(int fore, int back) { SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), fore + (back << 4)); }
If I remember correctly, there should be a link to tutorials on using the console around here someplace.
Last edited by Frobozz; 09-02-2004 at 01:35 PM.