You can use this function to vary the text colors of your output.
How to use text color in dev c++. For exampleyou can write textcolorYELLOW. To use the textbackground function all you need to do is before printing any text call this function with a parameter defining the color in capital letters. Now if you want your text to blink then while calling the textcolor function pass the color and also say BLINK.
This is not Visual C dependant I use this with DEv-C as well you just need the windows header enum Colors blue1 green cyan red purple yellow grey dgrey hblue hgreen hred hpurple hyellow hwhite. If you want yellow text 33 on blue background 44 you write 0333144m. We can color both the background and text color in the output screen in the following ways.
It is used to set the color of the character in Text Mode. Finalcolor 16backgroundcolor foregroundcolor if you want to set a text color that has a blue background and white text you simply look up the color code in the table. Use the textcolor function to define what color you want to use for text.
Blue is 1 and white is 15. This function sets the attributes of characters written to the console screen buffer by the WriteFile or WriteConsole functions. Where color is an integer variable.
Color your text in Windows console mode colors are 0black 1blue 2green and so on to 15white colorattribute foreground background 16 to get red text on yellow use 4 1416 228 light red on yellow would be 12 1416 236 FlushConsoleInputBufferhConsole. In this video I will show you how to print out unicode text using console applications on Windows in CCWe will use this function in our example. Colors background to light red with black text dombit 0.
Include include main textcolorRED. Void coutcint color char output HANDLE handle GetStdHandleSTD_OUTPUT_HANDLE. C Program for Printing number of Space 1 Not what you need.