Created
July 6, 2024 12:46
-
-
Save un4ckn0wl3z/eac659ff3924e493c9953aa4c18492d2 to your computer and use it in GitHub Desktop.
cterm.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Windows.h> | |
#include <iostream> | |
#include <stdio.h> | |
void EnableVirtualTerminalProcessing() { | |
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); | |
DWORD dwMode = 0; | |
GetConsoleMode(hOut, &dwMode); | |
dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; | |
SetConsoleMode(hOut, dwMode); | |
} | |
#define GREEN_TEXT "\033[32m" | |
#define RESET_TEXT "\033[0m" | |
int main() { | |
EnableVirtualTerminalProcessing(); | |
std::cout << GREEN_TEXT << "This text is green!" << RESET_TEXT << std::endl; | |
system("pause"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment