#include<stdio.h>
#include<stdlib.h>
int main(void)
{
char wjm[20];
char wjmm[200];
printf("A)注意必须将本程序和要加密的文件放在同一目录下\n\n");
printf("B)如果要解密文件则再次运行本程序即可\n\n");
printf("C)请输入要加密(解密)的文件名如wenjian.txt\n\n");
gets(wjm);
FILE *fp;
FILE *temp;
char ch;
fp=fopen(wjm,"r");
temp=fopen("abc.txt","w");
while(!feof(fp))
{
ch=fgetc(fp);
if((int)ch!=-1&&(int)ch!=0)
{
ch=~ch;
fputc(ch,temp);
}
}
fclose(temp);
fclose(fp);
sprintf(wjmm,"del %s",wjm);
system(wjmm);
sprintf(wjmm,"ren abc.txt %s",wjm);
system(wjmm);
getch();
return 0;
}
时间: 2024-10-12 13:26:35