Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 4a524c5 + a83e2e7 commit b64ca1cCopy full SHA for b64ca1c
chat.cpp
@@ -16,6 +16,7 @@
16
#include <unistd.h>
17
#elif defined (_WIN32)
18
#include <signal.h>
19
+#include <Windows.h>
20
#endif
21
22
#define ANSI_COLOR_RED "\x1b[31m"
@@ -886,6 +887,11 @@ int main(int argc, char ** argv) {
886
887
sigaction(SIGINT, &sigint_action, NULL);
888
889
signal(SIGINT, sigint_handler);
890
+ //Windows console ANSI color fix
891
+ HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
892
+ DWORD mode;
893
+ GetConsoleMode(hConsole, &mode);
894
+ SetConsoleMode(hConsole, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
895
896
897
fprintf(stderr, "%s: interactive mode on.\n", __func__);
0 commit comments