Skip to content

Instantly share code, notes, and snippets.

@nzbart
Created November 13, 2018 00:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nzbart/b138e8342009dc2e51ca322cc7488be0 to your computer and use it in GitHub Desktop.
Save nzbart/b138e8342009dc2e51ca322cc7488be0 to your computer and use it in GitHub Desktop.
Configure Windows for ANSI escape sequences to allow colour output in cross-platform manner
void configure_console_for_ansi_escape_sequences()
{
auto const console_window = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD startup_console_mode;
GetConsoleMode(console_window, &startup_console_mode);
SetConsoleMode(console_window, startup_console_mode | 0x0004);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment