Hi, I'm making an encryption program, not a very serious one really, but still I'm doing one. I'm having a problem though. I ask the user to input a string, and depending on what they want to call the file it is to be saved to, the length of the string it will encrypt it like:
Code:
for (int w=0; w<len; w++)
{
int BIT = sign*(w*(t*(42)));
fprintf(fp, "%c", MESSAGE[w]+BIT);
t++;
system ("CLS");
sign=-sign;
}
qu++;
something like that anyways. BIT is by what the characters deviate. Anyways, sometimes it puts a new line character in the encrypted codeword and when I try do decode it, it works up till that point. here's how I decode it:
Code:
for (int doubleu=0; doubleu<LEN; doubleu++)
{
int bit=sign*(doubleu*(T*(42)));
fscanf(FP, "%c", message[doubleu]+bit;
T++;
system ("CLS");
doubleu++;
sign=-sign;
}
this isn't exactly it, I can't find it on file, but if the file it creates, the one fp points to, has a new line in it, it won't let me decode the rest of it ...