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

📄 file_encrypt.cpp

📁 本程序介绍了如何用C语言快速读写磁盘文件。
💻 CPP
字号:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

void file_encrypt()
{
	FILE *fp;
	int i,j;
	char str[1024];

	fp = fopen( "F:\\Backup\\C_Sample\\File_operating\\File_testing.txt", "r+" );
	if(fp == NULL)
	{
		printf("cannot open the file\n");
		exit(0);
	}

	i = 0;
	while(1)
	{
		str[i] = fgetc(fp);
		if( feof(fp) )     //fp overflow,reach the end of file.
			break;

		str[i++] += 1;
	//	str[i++] -= 1;
	}

	fseek(fp,0L,SEEK_SET);
	for( j = 0; j < i; j++ )
		fputc(str[j],fp);

	fclose(fp);

	printf("please check the File_testing.txt file\n");
	return;
}

⌨️ 快捷键说明

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