美文网首页
NDK学习笔记 c语言文件加解密

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

作者: wbBin | 来源:发表于2017-09-16 15:55 被阅读0次

    ...

    //文件加密

    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");

    }

    ...

    相关文章

      网友评论

          本文标题:NDK学习笔记 c语言文件加解密

          本文链接:https://www.haomeiwen.com/subject/nlmuvttx.html