Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   C Encryption?? Adding Encryption To Text File? (http://www.go4expert.com/forums/c-encryption-adding-encryption-text-file-t7849/)

BillyBob 15Dec2007 04:34

C Encryption?? Adding Encryption To Text File?
 
Hi I have this code to send a .txt file between 2 computers, I want to know how can I add simple encryption to it?
Code:

#include <stdio>
#include <conio>

#define CNTRLZ 0x1A

char sourceFileName[] = "H:\\text.txt";
char commStreamName[] = "COM1";
FILE *commStream;
FILE *SouceFile;
char charToSend;
char ReadAccess[] = "r";
char WriteAccess[] = "w";
char errorMsg[] = "fail to open data file\n";
char fileopenflag[] = "r";
char EndOfFile[] = "EOF";

int main(void) {
FILE *fp;
FILE *dp;
int c;

if ((dp = fopen("COM1", "r")) == NULL) {
printf("fail to open COM port\n"); return 1;
}


if ((fp = fopen( sourceFileName, "w")) == NULL) {
printf("fail to open data file\n"); return 1;
}


while ((c = fgetc(fp )) != EOF) {
fputc( c, dp);
putch(c);

}

fputc('*', dp);
fclose(dp);
fclose(fp);
}

I don't have a clue and please can someone give me an idea? also where where I stick the code, I'm still a noob.

Salem 15Dec2007 13:18

Re: C Encryption?? Adding Encryption To Text File?
 
http://www.go4expert.com/showpost.ph...70&postcount=3
The poster doesn't want help to learn, he just wants a free lunch.
No point in even trying to help.

BillyBob 16Dec2007 23:37

Re: C Encryption?? Adding Encryption To Text File?
 
Bunch of fags, get off your computers and step outside for a minute.

pradeep 17Dec2007 11:55

Re: C Encryption?? Adding Encryption To Text File?
 
If you want simple encryption, try this http://en.wikipedia.org/wiki/Caesar_cipher, it's really easy to implement!


All times are GMT +5.5. The time now is 09:40.