include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
void dofile1(char *inputfile1,char *password1,char *outputfile1);
void file1()
{
char inputfile1[30];
char outputfile1[30];
char password1[8];
printf("\n +Please input the file address which you want to encrypt:\n");
gets(inputfile1);
printf("Please input the encrypted file address :\n");
gets(outputfile1);
dofile(inputfile1,password1,outputfile1);
}
void dofile1(char *inputfile1,char *password1,char *out_file1)
{
FILE *fp1,*fp2,*fp3;
register char ch,ch2;
int a,b;
printf("Please input the password1:");
scanf("%d",&a);
while (a>=26) a=a-26;
fp1=fopen(inputfile1,"rb");
if(fp1==NULL){
printf("Can't open the file address which you want to encrypt.\n");
exit(1);
}
fp2=fopen(out_file1,"wb");
if(fp2==NULL){
printf("Can't create the file which you want to conserve.\n");
exit(1);
}
while ((ch=fgetc(fp1))!=EOF)
{
if ((int)ch==' ')
{ fputc(ch,fp2);
continue;
}
b=(int)ch+a;
if ((b>90)&&((int)ch<=90)) b=b-26;
else if (b>122) b=b-26;
ch2=(char)b;
fputc (ch2,fp2);}
fclose(fp1);
fclose(fp2);
}