Regularity can block the console program? For example, when I output error information in yellow, and then later with white, but the original output error remains yellow?
Please bosses give directions, thank you!
CodePudding user response:
The console text output can be change colorCodePudding user response:
# include
#include
Int main (void)
{
HANDLE consolehwnd;//create a handle, handle knowledge in detail, please baidu or check the MSDN
Consolehwnd=
The GetStdHandle (STD_OUTPUT_HANDLE);//handle to instantiate
SetConsoleTextAttribute (consolehwnd FOREGROUND_RED);//set the font color
Printf (" hello ");
SetConsoleTextAttribute (consolehwnd, FOREGROUND_INTENSITY | FOREGROUND_GREEN);
Printf (" world! \n");
getchar();
SetConsoleTextAttribute (consolehwnd, BACKGROUND_INTENSITY | BACKGROUND_BLUE);
Printf (" Itisreallybeautiful! \n");
return 0;
}
CodePudding user response:
Ok, learned, thank you