As you can see it works fine so far and then changes and the rest of the data is lost.
(apologies i did the test multiple times for it to do this so i'm not sure if the error occurs during encryption or decryption).
Does anybody have any ideas why it's doing this or how i can fix it but keep it using the same methods it currently uses (pointer to read, casting for encryption, etc..). If no-one is able to help i know i should be able to set up a getline() loop but first i want to learn the errors i've made here!
Thanks.
Open the file for writing in binary mode, the same as you do for reading it in. Btw, you allocate memory via new every time read() is called, but never deallocate it.
yeah i found out it works perfectly fine without ios::out
How do i deallocate memory when i no longer need it (hopefully there's just a simple function i can put at the end of my encryption functions)?