Вы находитесь на странице: 1из 4

At first, I declared some variables, array and File instance.

Then I opened a file


Named “a.bat” with write mode and checking if the file can be opened or not. This
Software can convert your File/Folder to Control Panel and can restore again.

Then it ask the user to enter file or folder path and then ask 2 options. Using
switch case, we can check which option user selected. After then it ask to Enter
name of the file or folder and then using strcat() function, it concatenate Two
char array. After concatenating, full char array puts in file “a.bat” file. When
Closing the program, it removes that file.

Folder Protection Software in C Programming

Download Free Folder Protection Software in C Programming Source Code


#include<stdio.h>
#include<string.h>
#include<process.h>

void main()
{
FILE *p;
char ch,s[100];
char r[100]="REN ";
char u[]=".{21EC2020-3AEA-1069-A2DD-08002B30309D} ";
char v[50];
int choice,i;
p=fopen("a.bat","w+");
if(p==NULL)
{
printf("Error in opening the file a.c");
exit(0);
}
printf("This software can convert your File/Folder to Control Panel and can
Restore again.");
printf("\nEnter the path of the file: ");
fflush(stdin);
gets(s);
for(i=0; i<25; i++)
fputs("\nThis software is not responsible for any loss in data",p);
printf("\nEnter choice :");
printf("\n1.Protect Folder/File");
printf("\n2.Unprotect folder/File");
printf("\n3.Exit\n");
scanf("%d",&choice);

switch(choice)
{
case 1:
strcat(r,s);
printf("\nEnter new name of your folder/file: ");
fflush(stdin);
gets(v);
strcat(r," ");
strcat(r,v);
strcat(r,u);
break;
case 2:
strcat(r,s);
strcat(r,u);
printf("\nEnter new name of your folder/file: ");
fflush(stdin);
gets(v);
strcat(r,v);
break;
default:
fclose(p);
remove("a.bat");
exit(0);
}
fputs(r,p);
for(i=0; i<25; i++)
fputs("\nThis software is not responsible for any loss in data",p);
fputs("exit",p);

fclose(p);

system("a.bat");

remove("a.bat");

return 0;
}
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
#include<stdio.h>
#include<string.h>
#include<process.h>

void main()
{
FILE *p;
char ch,s[100];
char r[100]="REN ";
char u[]=".{21EC2020-3AEA-1069-A2DD-08002B30309D} ";
char v[50];
int choice,i;
p=fopen("a.bat","w+");
if(p==NULL)
{
printf("Error in opening the file a.c");
exit(0);
}
printf("This software can convert your File/Folder to Control Panel and can
Restore again.");
printf("\nEnter the path of the file: ");
fflush(stdin);
gets(s);
for(i=0; i<25; i++)
fputs("\nThis software is not responsible for any loss in data",p);
printf("\nEnter choice :");
printf("\n1.Protect Folder/File");
printf("\n2.Unprotect folder/File");
printf("\n3.Exit\n");
scanf("%d",&choice);

switch(choice)
{
case 1:
strcat(r,s);
printf("\nEnter new name of your folder/file: ");
fflush(stdin);
gets(v);
strcat(r," ");
strcat(r,v);
strcat(r,u);
break;
case 2:
strcat(r,s);
strcat(r,u);
printf("\nEnter new name of your folder/file: ");
fflush(stdin);
gets(v);
strcat(r,v);
break;
default:
fclose(p);
remove("a.bat");
exit(0);
}
fputs(r,p);
for(i=0; i<25; i++)
fputs("\nThis software is not responsible for any loss in data",p);
fputs("exit",p);

fclose(p);

system("a.bat");

remove("a.bat");

return 0;
}

Вам также может понравиться