-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
72 lines (62 loc) · 1.15 KB
/
main.c
File metadata and controls
72 lines (62 loc) · 1.15 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// DBMS CLASS - ASSIGNMENT <FILEMENU SYSTEM> @ 16/01/2025
// 634 LOC
#include "utils/coreUtils.h"
#include "core/file.h"
#include "auth/auth.h"
void menu(); //Forward Declaration
int main(int argc, char** argv)
{
if(argv[1] != NULL) filename = argv[1];
if(!authenticate()) myerror("Invalid Password.");
menu();
return 0;
}
void menu()
{
int c;
do
{
printf("\n------FILE MENU------\n");
printf("1. Create a new file\n");
printf("2. Append to a file\n");
printf("3. Search in file\n");
printf("4. Delete entry\n");
printf("5. Update entry\n");
printf("6. Display file\n");
printf("7. Delete file\n");
printf("8. Exit\n");
printf("\n>> ");
scanf("%d", &c);
switch(c)
{
case 1:
createNewFile();
break;
case 2:
appendFile();
break;
case 3:
searchFile();
break;
case 4:
deleteEntry();
break;
case 5:
updateEntry();
break;
case 6:
displayFile();
break;
case 7:
deleteFile();
break;
case 8:
printf("\nExiting...\n");
break;
default:
system("clear");
printf("ERROR: Invalid input. Please try again.\n\n");
break;
}
}while(c!=8);
}