You're using string semantics to handle binary data. That's not going to work. If you look closely you'll see that the first character in your file.
Txt example output is k which is also the first character of the key. That means your data is starting with a NUL byte and the while loop will instantly exit First of all you need to open the files in binary mode: fp=fopen("key","wb"); fq=fopen("file. Txt","wb") To write the key use fwrite(key, keylen, 1, fp) and then use the for loop in your second example to write the data.
I can't see anything wrong with that one, your problem might simply have been the binary vs text mode Edit: Try using hexdump -C file. Txt to view your file instead of cat.
You're using string semantics to handle binary data. That's not going to work. If you look closely you'll see that the first character in your file.
Txt example output is k, which is also the first character of the key. That means your data is starting with a NUL byte and the while loop will instantly exit. First of all you need to open the files in binary mode: fp=fopen("key","wb"); fq=fopen("file.
Txt","wb"); To write the key use fwrite(key, keylen, 1, fp); and then use the for loop in your second example to write the data. I can't see anything wrong with that one, your problem might simply have been the binary vs text mode. Edit: Try using hexdump -C file.
Txt to view your file instead of cat.
The part about the null byte is probably his problem. The part about fopen probably isn't relevant (aside from portability) though, since it looks like he's on a Linux or Unix system and "wb" and "w" are probably equivalent in this case. – Dmitri Oct 1 at 18:18 Maybe.
He does have a 0A in the encrypted output though. – Per Johansson Oct 1 at 18:21 thnx it helped a lot... – Udit Gupta Oct 1 at 20:06.
Here while(datad) { fputc((int)datad,fq); d++; } datad is 0 (as it is binary data), so it will leave the loop "too" soon.
You're using string semantics to handle binary data. That's not going to work. If you look closely you'll see that the first character in your file.
Txt example output is k, which is also the first character of the key. That means your data is starting with a NUL byte and the while loop will instantly exit. And then use the for loop in your second example to write the data.
I can't see anything wrong with that one, your problem might simply have been the binary vs text mode. Edit: Try using hexdump -C file. Txt to view your file instead of cat.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.