Skip to content

Instantly share code, notes, and snippets.

@yi-jiayu
Created July 19, 2016 09:09
Show Gist options
  • Save yi-jiayu/aedcbce39ed69844b47e620d72afbe6a to your computer and use it in GitHub Desktop.
Save yi-jiayu/aedcbce39ed69844b47e620d72afbe6a to your computer and use it in GitHub Desktop.
Manipulating a compatible terminal using escape sequences
#include <stdio.h>
main(void) {
\\ enter alternate screen mode
printf("\033[?1049h");
\\ move the cursor to the upper left corner
printf("\033[H");
printf("Hello, World");
\\ move the cursor right 7 steps
printf("\033[7C");
\\ move the cursor down 2 steps
printf("\033[2B");
printf("Interesting");
\\ exit alternate screen mode
printf("\033[?1049l");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment