-
Notifications
You must be signed in to change notification settings - Fork 101
/
logcrypt.h
57 lines (52 loc) · 1.3 KB
/
logcrypt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
void Encrypt0r(char * FILENAME, char * NEW_FILENAME)
{
FILE *inFile; //Declare inFile
FILE *outFile; //Declare outFile
char Byte;
char newByte;
// int n;
// int i=0;
inFile = fopen(FILENAME, "rb");
outFile = fopen(NEW_FILENAME, "w");
if (inFile == NULL || outFile == NULL) {
printf("Error in opening file");
return 1;
} else {
while (1) {
while ( !feof( inFile ) ) {
Byte = fgetc(inFile);
newByte = Byte + 25;
fputc(newByte, outFile);
}
break;
}
fclose(inFile);
fclose(outFile);
}
}
void Decrypt0r (char *FILENAME, char *NEW_FILENAME)
{
FILE *inFile; //Declare inFile
FILE *outFile; //Declare outFile
char Byte;
char newByte;
// int i=0;
inFile = fopen(FILENAME, "rb");
outFile = fopen(NEW_FILENAME, "w");
if (inFile == NULL || outFile == NULL) {
printf("Error in opening file");
return 1;
} else {
while (1) {
printf(".");
while ( !feof( inFile ) ) {
Byte = fgetc(inFile);
newByte = Byte - 25;
fputc(newByte, outFile);
}
break;
}
fclose(inFile);
fclose(outFile);
}
}