-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.c
49 lines (45 loc) · 1013 Bytes
/
main.c
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 "encrypter.h"
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[])
{
int choice;
char f_name[20]; // file name
FILE *fp = NULL;
printf("\t\t\tWelcome to File Encrypter\n\n");
printf("\n\tEnter the file name : ");
gets(f_name);
fp = fopen(f_name, "r+");
if (fp == NULL)
{
printf("\tFile Openning Error..!!!");
exit(-1);
}
while (1)
{
printf("\n\n\t1.Encrypt File\n\t2.Decrypt File\n\t3.Clear Encrypted file\n\t4.Clear Decrypted File\n\t5.Exit\n");
scanf("%d", &choice);
switch (choice)
{
case 1:
encrypt(fp);
break;
case 2:
decrypt();
break;
case 3:
remove("encrypt.txt");
printf("\n\tencrypt file cleared..\n\n");
break;
case 4:
remove("decrypt.txt");
printf("\n\tdecrypt file cleared...\n\n");
break;
case 5:
exit(1);
default:
printf("\tWrong Choice..!!!\n\n\n");
}
}
fclose(fp);
return 0;
}