Using and older C++ book, about 12 years old if that may have some significance. I am sure I wrote the example down verbatim, but when I enter a name and age, the output to the file is nothing more than what looks like Chinese characters. Does anyone know where my mistake is?
I guess you opened the file using notepad. When you open a binary file using notepad, this usually happens. This is because the data of the 'age' variable isn't usual text. Try
1 2 3 4
ifstream input_file("C:/Users/Mike/Desktop/fdata.txt",ios::binary);
Person person;
input_file.read(reinterpret_cast<char*>(&person),sizeof(person));
person.show_data();
If the data shown is wrong, then there is a problem.