Answers for "change text color c"

C
1

change text color c

#include <stdio.h>
#include <windows.h> 

#define COLOR_DEFAULT 7
#define LIGHT_RED 12

void setColor(int color);

int main()
{
	setColor(LIGHT_RED);
	printf("This text is red");
    setColor(colorDefault);
}

void setColor(int color)
{
	HANDLE  hConsole;
	hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleTextAttribute(hConsole, color);
}
Posted by: Guest on January-28-2021

Code answers related to "C"

Browse Popular Code Answers by Language