⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 58.c

📁 包含了105个经典实用的C语言程序
💻 C
字号:
#include<stdio.h>
#include<stdlib.h>
int main()
{
	FILE * sourcefile;
	FILE * keyfile;
	FILE * destfile;
	char ch,keych;
	int i;
	puts("****************************************");
	puts("* The file will encrypt the source.txt *");
	puts("****************************************");
	
	if(!(sourcefile = fopen("source.txt","r")))
 	{
  		printf("Can not open the source file\n");
  		exit(-1);
 	}
	if(!(destfile = fopen("destfile.txt","w+")))
 	{
  		printf("Can not open the destination  file\n");
  		exit(-1);
 	}
	if(!(keyfile= fopen("keyfile.txt","w+")))
 	{
  		printf("Can not open the keyfile  file\n");
  		exit(-1);
 	}
	printf("\n.....Encrypting....\n");
	i = 0;
	while(!feof(sourcefile))
 	{
 		randomize();
		keych = random(112 - i) +16;
		ch = fgetc(sourcefile);
  		ch = ch ^ keych;
  		fputc(ch,destfile);
		fputc(keych,keyfile);
		i = ( ++i)%16;
 	}
	printf("Encrypted the souce.txt successfully!\n");
	fclose(sourcefile);
	fclose(keyfile);
	fclose(destfile);
	getch();
	return 1;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -