Problems reading a binary file C++
I'm working with binary files, and I'm trying to read a binary file where it contains emails, my problem is, when I declare a variable in my class, and I try to search by sender, it doesn't work, somehow, it doesn't read the last register, but ONLY if I declare the variable, when I don't declare the variable, searching by sender works perfectly; the variable that I declared in my class, it doesn't have name collision, I only declared it, so... I should not have any problem, but I don't know why, when I declared a variable in my class, searching by sender doesn't works. This is a weird problem for me and is the first time I see that, declaring a variable, makes something useless. Here is the code: https://code.sololearn.com/caR2UIP9LAk4/#cpp NOTE: The most important parts are lines 51 (the horrible variable variable in class ElectronicEmail.hoo) and 242-256, class ReadEmail.cpp (where I read the binary file to find the sender and compare it with the sender that the user wrote). Also I'm working in QT.