Created
April 15, 2016 04:07
-
-
Save Qix-/6f659c6b7e7217dca020be47a22fd085 to your computer and use it in GitHub Desktop.
Skinnify
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 <iostream> | |
#include <string> | |
#include <deque> | |
using namespace std; | |
int main(int argc, char **argv) { | |
if (argc < 2) return 1; | |
int backsize = atoi(argv[1]); | |
deque<string> backlog(backsize, ""); | |
cout << string(backsize, '\n'); | |
string line; | |
while (getline(cin, line)) { | |
backlog.pop_front(); | |
backlog.push_back(line); | |
cout << "\x1b[G\x1b[" << backsize << "A"; | |
for (string s : backlog) cout << "\x1b[K" << s << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment