Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool CoinsDatabase::save(const QString &filename)
- {
- bool opened = false; //успешность открытия файла
- if (!filename.isEmpty())
- {
- QFile file(filename);
- opened = file.open(QIODevice::WriteOnly);
- modified = false;
- QDataStream output(&file);
- output << db << ids << maxId;
- file.close();
- }
- return opened;
- }
- bool CoinsDatabase::load(const QString &filename)
- {
- bool opened = false; //успешность открытия файла
- if (!filename.isEmpty()) //если имя файла не пустое
- {
- //создаем файл
- QFile file(filename);
- //открываем файл только для чтения
- opened = file.open(QIODevice::ReadOnly);
- if (opened)
- { //если открыт успешно
- modified = false;
- QDataStream output(&file);
- output >> db >> ids >> maxId;
- file.close();
- }
- }
- return opened;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement