mind explaning to me how those codes work ?Code:#include <stdio.h> #include <windows.h> int main ( void ) { HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE ); WORD wOldColorAttrs; CONSOLE_SCREEN_BUFFER_INFO csbiInfo; /* * First save the current color information */ GetConsoleScreenBufferInfo(h, &csbiInfo); wOldColorAttrs = csbiInfo.wAttributes; /* * Set the new color information */ SetConsoleTextAttribute ( h, FOREGROUND_RED | FOREGROUND_INTENSITY ); printf ( "This is a test\n" ); /* * Restore the original colors */ SetConsoleTextAttribute ( h, wOldColorAttrs); return 0; }
1 more question ...
when i add system("color 1F") at the beginning of the codes above, the background of "This is a test" is still black colour, how do i change it to become blue background ?