-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebncurses.h
executable file
·72 lines (59 loc) · 1.25 KB
/
webncurses.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef _WEBNCURSES_H_
#define _WEBNCURSES_H_
#include <stdio.h>
#include <iostream>
#include <string>
#include <map>
#include <fstream>
using namespace std;
typedef ofstream WINDOW;
WINDOW mainwin;
ifstream maininwin;
WINDOW * initscr() {
system("mkfifo main.input.win");
system("chmod 777 main.input.win");
string filename = "main.output.win";
mainwin.open(filename.c_str());
mainwin << "NEW WINDOW" << endl;
return &mainwin;
}
void delwin(WINDOW * todel) {
(*todel).close();
remove("main.output.win");
remove("main.input.win");
}
void endwin() {
mainwin << "QUIT" << endl;
mainwin.close();
}
void mvaddstr(int x, int y, const char* instring) {
string temp(instring);
mainwin << "[" << x << " " << y << "]" << " " << temp << endl;
}
void refresh() {
// Do nothing
}
void getstr(char * dst) {
string tmp = "";
mainwin << "INPUT [STR]" << endl;
maininwin.open("main.input.win");
do {
getline(maininwin, tmp);
} while (tmp == "");
maininwin.close();
strcpy(dst, tmp.c_str());
}
char getch() {
char tmp = '\0';
mainwin << "INPUT [CH]" << endl;
maininwin.open("main.input.win");
do {
maininwin >> tmp;
} while(tmp == '\0');
maininwin.close();
return tmp;
}
void wrefresh(WINDOW * win) {
// Do nothing
}
#endif