Advertisement
MaksNew

Untitled

Feb 12th, 2021
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. ofstream fout;
  2. int demon = sizeof(demo);
  3. fout.open(path, ios_base::trunc | ios::binary);
  4. int i = 0;
  5. while (i < 3)
  6. {
  7. fout.write((char*)&demo[i], demon);
  8. ++i;
  9. }
  10. fout.close();
  11.  
  12. ifstream fin;
  13. fin.open(path, ios::beg | ios::binary);
  14. worker* buf = new worker[3];
  15. i = 0;
  16. while (i < 3)
  17. {
  18. fin.read((char*)&buf[i], demon);
  19. cout << buf[i].name << " " << buf[i].detailsOnMonday << " " << buf[i].detailsInTuesday << " " << buf[i].detailsInWednesday << " " << buf[i].detailsInThursday << " " << buf[i].detailsOnFriday << " " << buf[i].detailsOnSaturday << endl;
  20. ++i;
  21. }
  22. fin.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement