Skip to content

Instantly share code, notes, and snippets.

@darkvertex
Forked from lunasorcery/misleading-cat.cpp
Created November 3, 2021 04:54
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 darkvertex/2141ad7fb02b03e4aedaa161cae1b3e0 to your computer and use it in GitHub Desktop.
Save darkvertex/2141ad7fb02b03e4aedaa161cae1b3e0 to your computer and use it in GitHub Desktop.
/* So how does this work?
I'm using ANSI escape sequences to control the behavior of the terminal while
cat is outputting the text. I deliberately place these control sequences inside
comments so the C++ compiler doesn't try to treat them as code.*/
//
/*The commands in the fake code comment move the cursor to the left edge and
clear out the line, allowing the fake code to take the place of the real code.
And this explanation uses similar commands to wipe itself out too. */
//
#include <cstdio>
int main() {
printf("Fooled you!\n");// printf("Hello, World!\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment