I read the string back to decrypt, does not give the whole string back but truncate the string.
Then you are opening the file incrrectly. Since the file contains embedded NULL bytes it must be opened in binary mode and use std::string's read() method.
when decrypting I can avoid them?
You can't just ignore them because they are part of the encryption algorithm. Decryption will be rendered useless without them.