There is such a structure:
struct account { string login; string pass; bool admin; }; And such a function:
bool auth() { account user; account input; ifstream fin("users.bin", ios::binary | ios::in); if (fin.is_open()) { while (true) { system("cls"); cout << "login: "; getline(cin, input.login); cout << "pass: "; getline(cin, input.pass); while (!fin.eof()) { fin.read((char*)&user, sizeof(user)); if (input.login == user.login && input.pass == user.pass) { fin.close(); system("cls"); cout << "hello, " << user.login << "\n" << endl; cout << "press any key..."; _getwch(); return user.admin; } } system("cls"); cout << "Incorrect login or password\n" << endl; cout << "press any key..."; _getwch(); fin.clear(); fin.seekg(0, ios::beg); } } else { cout << "File is not avalible" << endl; abort(); } } When the function is terminated, the user object apparently cannot be removed, and an exception is raised read access violation