文件操作(解密加密)
生活随笔
收集整理的這篇文章主要介紹了
文件操作(解密加密)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
文件加密:
#include<stdio.h> #include<string.h> #include<stdlib.h>void code(char *s) {while(*s){(*s)++;s++;} }int main() {char s[1024] = {0};FILE *p = fopen("/home/exbot/wangqinghe/C/20190716/file.txt","r");FILE *p1 = fopen("/home/exbot/wangqinghe/C/20190716/b.txt","w");while(!feof(p)){memset(s,0,sizeof(s));fgets(s,sizeof(s),p);code(s);fputs(s,p1);}fclose(p);fclose(p1);return 0; }文件解密:
#include<stdio.h> #include<string.h> #include<stdlib.h>void decode(char *s) {while(*s){(*s)--;s++;} }int main() {char s[1024] = {0};FILE *p = fopen("/home/exbot/wangqinghe/C/20190716/b.txt","r");FILE *p1 = fopen("/home/exbot/wangqinghe/C/20190716/a.txt","w");while(!feof(p)){memset(s,0,sizeof(s));fgets(s,sizeof(s),p);decode(s);fputs(s,p1);}fclose(p);fclose(p1);return 0; }?
轉載于:https://www.cnblogs.com/wanghao-boke/p/11196855.html
總結
以上是生活随笔為你收集整理的文件操作(解密加密)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 时间都知道剧情介绍
- 下一篇: 什么是针灸介入试管婴儿