Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ADMIN registration and authenticate
- void setAdminRegistration(const string& path, const string& login, const string& password)
- {
- if (login.size() == 0 and password.size() == 0)
- {
- throw exception("Error! Entered incorrectly login or password!");
- }
- else
- {
- //fstream in;
- //in.open(path, fstream::in | fstream::out | fstream::trunc);
- ifstream fin(path, ios::in);
- int size1 = sizeFile(path);
- if (!fin.is_open())
- {
- throw file_not_found("Error! File not found!");
- }
- else
- {
- Adminstrator temp(login, password);
- int temp_size = Adminstrator::adminID;
- fin >> temp_size;
- fin.ignore();
- getline(fin >> ws, temp.login);
- getline(fin >> ws, temp.password);
- }
- int size2 = sizeFile(path);
- if (size1 == size2)
- {
- throw exception("Error! The system crashed!\n");
- }
- fin.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment