Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. int decrypt(int key){
  2.     int c, i;
  3.     char newc;
  4.     printf("%d",key);
  5.     FILE *file, *fp;
  6.     file = fopen("mystery01.txt", "r");
  7.     fp = fopen ("decrypt.txt", "w+");
  8.  
  9.     if (file == NULL){
  10.         return 0;
  11.     }
  12.     while((c = fgetc(file)) != EOF){
  13.         c = c - key;
  14.         while (c < 0){
  15.             c +=256;
  16.             if (c > 0){
  17.                 break;
  18.             }
  19.         }
  20.         fputc(c, fp);
  21.     }
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement