forked from rafiibrahim8/Vault-Blaster
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhavKey.c
More file actions
61 lines (54 loc) · 1.58 KB
/
Copy pathhavKey.c
File metadata and controls
61 lines (54 loc) · 1.58 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
#include<stdio.h>
#include<string.h>
#include<conio.h>
unsigned char getKey(int x);
int havFile(char *fname);
int fileWrite(char *inFileName, char *outFileName, unsigned char key);
int getExt(char fileName[],char ext[]);
void havKey(void)
{
char choice,fileName[100],deFileName[100],fext[10];
unsigned char key;
int exErr,err;
printf("\nEnter file Name (with extension):");
gets(fileName);
while(!havFile(fileName))
{
printf("\n\aFile Not Found! Make sure you have entered correct file name with extension.\nPlease enter again: ");
gets(fileName);
}
key=getKey(0);
printf("\nEnter New File Name: ");
gets(deFileName);
printf("\nWant to use automatic file type detection?\n\tY=Yes\n\tAnyKey=No");
choice=getch();
if(choice=='y' || choice=='Y')
{
exErr=getExt(fileName,fext);
if(exErr<0)
{
printf("\nAutomatic file type detection failed!\nPlease Enter File extension:");
gets(fext);
strcat(deFileName,".");
strcat(deFileName,fext);
}
else
{
strcat(deFileName,fext);
printf("\nFile Type Detected: %s",fext);
}
}
else
{
printf("\nEnter file extension: ");
gets(fext);
strcat(deFileName,".");
strcat(deFileName,fext);
}
printf("\nMaking File...");
err=fileWrite(fileName,deFileName,key);
if(err)
printf("\n\aOperation Failed.");
else
printf("\nOperation Complete!");
}