Encrypt and Decrypt folders and files using C language
#include<stdio.h>
#include<conio.h>
#include<string.h>
void crypt(char arr1[],int ch)
{
char arr2[9];
int len,stat;
len=strlen(arr1);
if(len<=7)
{
strcpy(arr2,arr1);
arr2[len]=255;
arr2[len+1]=NULL;
if(ch==1)
{
stat=rename(arr1,arr2);
}
if(ch==2)
{
stat=rename(arr2,arr1);
}
if(stat==0)
{
printf("Operation successfull");
}
else
{
printf("Procedure fail");
}
}
else
{
printf("\nEnter folder name less equal to 7");
}
}
void main()
{
char arr1[9];
int ch;
clrscr();
printf("1.Encrypt\n2.Decrypt\n¯");
scanf("%d",&ch);
printf("Enter the old folder name:");
scanf("%s",arr1);
crypt(arr1,ch);
getch();
}
0 comments:
Post a Comment
You are most welcome for making comments here. I will consider your view and will reply you soon.