-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
82 lines (76 loc) · 2.33 KB
/
main.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
#include <iostream>
#include <fcntl.h>
#include "FileHander.h"
#include "GloableDefine.h"
#include <pthread.h>
#include <commonHandler.h>
//#include <process.h>
using namespace std;
int main() {
cout<< "linux 2020 homework 202021230110 yangyang"<< endl;
File_Hander* temp_File = new File_Hander;
bool system_Flag = true;
char temp_Cin;
pthread_t pthreadIndexFile;
if(temp_File->judgeAddOrNot()){
// 没有任何文件
cout<<"No Files"<<endl;
return 0;
}
else{
cout << "enter the system(y/n)?" << endl;
cin>>temp_Cin;
if (temp_Cin == 'y') {
system_Flag = true;
}
else {
system_Flag = false;
delete temp_File;
}
while (system_Flag) {
// 清屏
// system("cls");
// 增
pthread_create(&pthreadIndexFile,NULL,threadCreatIndexFile,(void*)temp_File);
cout<<"a-------InsertData"<<endl;
// 删
cout<<"b-------DeleteData"<<endl;
// 改
cout<<"c-------UpdateData"<<endl;
// 查
cout<<"d-------SearchData"<<endl;
// 查看当前数据
cout<<"e-------ShowData"<<endl;
cin>>temp_Cin;
pthread_join(pthreadIndexFile,NULL);
if(temp_Cin =='a' ||temp_Cin =='b' ||temp_Cin =='c' ||temp_Cin =='d'||temp_Cin =='e'){
switch(temp_Cin){
case 'a':
if(temp_File->appendArowToFile()){
continue;
}
break;
case 'b':
if(temp_File->deleteArowToFile()){
continue;
}
break;
case 'c':
if(temp_File->alterArowToFile()){
continue;
}
break;
case 'd':
temp_File->searchFileCondition();
break;
case 'e':
temp_File->showCurrentTableData();
break;
default:
continue;
}
}
}
return 0;
}
}