NDK学习笔记 c语言文件加解密

...

//文件加密

void encode(char normal_path [],char encode_path []){

FILE * normal_fp = fopen(normal_path, "r");

FILE * encode_fp = fopen(encode_path, "w");

int ch;

while ((ch = fgetc(normal_fp))!=EOF)

{

fputc(ch ^ 7, encode_fp);

}

fclose(normal_fp);

fclose(encode_fp);

}


//文件解密

void decode(char encode_path[], char decode_path[]) {

FILE * normal_fp = fopen(encode_path, "r");

FILE * encode_fp = fopen(decode_path, "w");

int ch;

while ((ch = fgetc(normal_fp)) != EOF)

{

fputc(ch ^ 7, encode_fp);

}

fclose(normal_fp);

fclose(encode_fp);

}

void main() {

char * normal_path = "F:\\open.txt";

char * encode_path = "F:\\openone.txt";

char * decode_path = "F:\\opendecode.txt";

//encode(normal_path, encode_path);

decode(encode_path, decode_path);

system("pause");

}


...

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容