-
Notifications
You must be signed in to change notification settings - Fork 0
/
get.cpp
executable file
·113 lines (112 loc) · 2.94 KB
/
get.cpp
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include<fstream>
#include<iostream>
#include<cstring>
using namespace std;
char dir[1000];
char lev[1000], bot[1000], usr[1000];
void getdir(){
//int typeU;
fstream file;
file.open("/tmp/zffuser", ios::in);
streambuf* stream_buffer_cout = cout.rdbuf();
streambuf* stream_buffer_cin = cin.rdbuf();
streambuf* stream_buffer_file = file.rdbuf();
cin.rdbuf(stream_buffer_file);
cin>>dir;
cin.rdbuf(stream_buffer_cin);
file.close();
//return typeU;
if (display_log) cout << " >> Getting user config dir\n " << dir << endl;
}
void getinit()
{
//strcat(dir, gshell("echo $HOME/.local/share/ohzff-zff/"));
strcat(dir, "/.local/share/ohzff-zff/");
strcpy(lev,dir);
strcpy(bot,dir);
strcpy(usr,dir);
strcat(lev,"level");
strcat(bot,"boot");
strcat(usr,"user");
if (display_log){
cout << " >> Getting config file path\n";
cout << " -> Level : " << lev << endl;
cout << " -> Boot : " << bot << endl;
cout << " -> Username : " << usr << endl;
}
}
int getlevel(){
int typeU;
fstream file;
file.open(lev, ios::in);
streambuf* stream_buffer_cout = cout.rdbuf();
streambuf* stream_buffer_cin = cin.rdbuf();
streambuf* stream_buffer_file = file.rdbuf();
cin.rdbuf(stream_buffer_file);
cin>>typeU;
cin.rdbuf(stream_buffer_cin);
file.close();
return typeU;
}
void putlevel(int n){
fstream file;
file.open(lev, ios::out);
streambuf* stream_buffer_cout = cout.rdbuf();
streambuf* stream_buffer_cin = cin.rdbuf();
streambuf* stream_buffer_file = file.rdbuf();
cout.rdbuf(stream_buffer_file);
system("clear");
cout<<n;
cout.rdbuf(stream_buffer_cout);
file.close();
}
int getboot(){
int typeU;
fstream file;
file.open(bot, ios::in);
streambuf* stream_buffer_cout = cout.rdbuf();
streambuf* stream_buffer_cin = cin.rdbuf();
streambuf* stream_buffer_file = file.rdbuf();
cin.rdbuf(stream_buffer_file);
cin>>typeU;
cin.rdbuf(stream_buffer_cin);
file.close();
return typeU;
}
void putboot(int n){
fstream file;
file.open(bot, ios::out);
streambuf* stream_buffer_cout = cout.rdbuf();
streambuf* stream_buffer_cin = cin.rdbuf();
streambuf* stream_buffer_file = file.rdbuf();
cout.rdbuf(stream_buffer_file);
system("clear");
cout<<n;
cout.rdbuf(stream_buffer_cout);
file.close();
}
string getuser(){
string typeU;
fstream file;
file.open(usr, ios::in);
streambuf* stream_buffer_cout = cout.rdbuf();
streambuf* stream_buffer_cin = cin.rdbuf();
streambuf* stream_buffer_file = file.rdbuf();
cin.rdbuf(stream_buffer_file);
getline(cin,typeU);
cin.rdbuf(stream_buffer_cin);
file.close();
return typeU;
}
void putuser(string n){
fstream file;
file.open(usr, ios::out);
streambuf* stream_buffer_cout = cout.rdbuf();
streambuf* stream_buffer_cin = cin.rdbuf();
streambuf* stream_buffer_file = file.rdbuf();
cout.rdbuf(stream_buffer_file);
system("clear");
cout<<n;
cout.rdbuf(stream_buffer_cout);
file.close();
}