c语言对文件简单加密学习代码

2022-07-11 19:19:18   文档大全网     [ 字体: ] [ 阅读: ]

#文档大全网# 导语】以下是®文档大全网的小编为您整理的《c语言对文件简单加密学习代码》,欢迎阅读!
加密,语言,代码,简单,文件
#define _CRT_SECURE_NO_WARNINGS #include #include #include

void jiami(char *path, char *pathjiami) {

FILE *p = fopen(path, "r");

FILE *q = fopen(pathjiami, "w"); if (p == NULL||q==NULL) {

return; }

while (!feof(p)) {

char ch;

ch = fgetc(p); putchar(ch); }

rewind(p);

while (!feof(p)) {

char ch;

ch = fgetc(p); putchar(ch+1); fputc(ch + 1, q); }

fclose(p); fclose(q); }

void jiemi(char *path, char *pathjiemi) {

FILE *p = fopen(path, "r");

FILE *q = fopen(pathjiemi, "w"); if (p == NULL || q == NULL) {

return; }

while (!feof(p)) {

char ch;

ch = fgetc(p);


fputc(ch - 1, q); }

fclose(p); fclose(q); }

void main() {

char *path = "C:\\users\\xiaokang\\Desktop\\1.txt";

char *pathjiami = "C:\\Users\\xiaokang\\Desktop\\jiami.txt "; char *pathjiemi = "C:\\Users\\xiaokang\\Desktop\\jiemi.txt"; jiami(path, pathjiami);

jiemi(pathjiami, pathjiemi); system("pause"); }







本文来源:https://www.wddqxz.cn/988a38131ed9ad51f11df237.html

相关推荐