www.flickr.com

Color funtion in Visual C++ and other non-Turbo C Compilers

Monday, October 31, 2011 Posted by Glenn

In Turbo C and Turbo C++, there are so many functions (colors, gotoxy and etc...) that you can't find in devC++ and other non Turbo Compilers. However, you can make your own function. Here:

For Colors:


void setcolor(unsigned short color)
{
HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hcon,color);
}




Note that you should include a windows header in your source codes. By the way, you can use the system function, sorry I can't recall the codes but the codes above is much better because you can also change the background color of your program.

glenn von

Author: Glenn Posadas

20 year old 5th year Computer Engineering Student, a blogger, photographer, programmer, and an electronics hobbyist; a Christian who loves God very much..

Sharing is so Easy:
StumpleUpon DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google Twitter FaceBook

Labels: ,

Post a Comment

Drop a comment. Thank you guys!