Image "EXCEPTION ERROR at the end of function" when I execute this function , everything goes fine,data is displayed but at the end,program stops saying like "YourFile.exe stopped working". and while debugging,enter image description here at the end of function,we get over to this exception type issue.
void readfn(const char* address, const int index) {
system("cls"); char key;
ifstream in; string line; int newindex = index; Book b2;
in.open(address,ios::binary);
if (in.is_open()) {
in.seekg(0, ios::beg);
cout << "\n tellg in readfn:" << in.tellg();
in.read((char*)&b2, sizeof(Book));
while (!in.eof()) {
b2.display();
in.read((char*)&b2, sizeof(Book));
}
in.close();
}
else {
cout << "Error while opening File for Reading";
}
//cin.ignore();
cout << "\n Press any key to return to Main Menu:";
cin >> key;
cin.ignore();
}