Try opening the encrypted file in binary mode when you're reading and writing to it.
Also try
to make sure your basic file handling is OK. If the output isn't a copy of the input, you need to address that problem first.Code:char encrypt(char letter, int pass, int i) { return letter; }