Created
January 28, 2015 13:49
-
-
Save guswns0528/7788f6f1555fcfbbd4ff to your computer and use it in GitHub Desktop.
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 <cstdio> | |
#include <cstring> | |
extern "C" { | |
#include <unistd.h> | |
} | |
constexpr int row = 23; | |
constexpr int column = 80; | |
char backbuffer[2000]; | |
char get(int x, int y) | |
{ | |
return backbuffer[column * y + x]; | |
} | |
void set(int x, int y, char c) | |
{ | |
backbuffer[column * y + x] = c; | |
} | |
void init() | |
{ | |
memset(backbuffer, ' ', sizeof(backbuffer)); | |
backbuffer[row * column] = '\0'; | |
} | |
int main(void) | |
{ | |
init(); | |
for (int i = 0; i < row; i++) | |
{ | |
set(0, i, 'a' + i); | |
} | |
while (true) | |
{ | |
printf("%s", backbuffer); | |
fflush(stdout); | |
usleep(1000000); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment