-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhackertyper.cpp
More file actions
49 lines (38 loc) · 1.11 KB
/
hackertyper.cpp
File metadata and controls
49 lines (38 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <bits/types/struct_timeval.h>
#include <stdlib.h>
#include <sys/select.h>
#include <termios.h>
#include <unistd.h>
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <string.h>
std::string str = " std::string str[5] = { \"linux\", \"system\", \"git\", \"advanced\", \"command\" };\n\nint main() {\n\nstruct termios oldSettings, newSettings;\n\nint i = 0;\nstd::string text = "";\n\ntcgetattr(fileno( stdin), &oldSettings);\n";
int main() {
struct termios oldSettings, newSettings;
int i = 0;
std::string text = "";
tcgetattr(fileno( stdin), &oldSettings);
newSettings = oldSettings;
newSettings.c_lflag &= (~ICANON & ~ECHO);
tcsetattr(fileno( stdin), TCSANOW, &newSettings);
fd_set set;
struct timeval tv;
tv.tv_sec = 10;
tv.tv_usec = 0;
FD_ZERO(&set);
FD_SET(fileno( stdin ), &set);
int res = select(fileno( stdin) + 1, &set, NULL, NULL, &tv);
while (res > 0) {
char c;
system("clear");
text += str[i];
std::cout << text << std::endl;
i++;
if(i >= str.length())
i = 0;
read(fileno(stdin), &c, 1);
}
tcsetattr(fileno( stdin), TCSANOW, &oldSettings);
return 0;
}