summaryrefslogtreecommitdiffstats
path: root/Bachelor/Prog2/Codebeispiele/Student/StudDat.cpp
blob: 306ae62c2f4ddac9f4cab937b110f4e0e2bd5240 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Persistence of objects: Storing of Student-Objects
// Author: Hans-Peter Weber
// Date: 07.03.05

#include <iostream>
using std::cout;
using std::endl;
using std::ios;

#include <fstream>
using std::fstream;

#include "Student.h"

int main() 
{	
   Student stud;

   cout << "Adresse von Student-Objekt: " << &stud << endl;
   cout << "Groesse von Student-Objekt: " << sizeof( Student ) << " Byte" << endl;

/* fstream outFile( "Studs.seq", ios::binary | ios::out );  // write
   stud.set( "Hans Castorp", 578111, 23 );
   stud.write( outFile );
   stud.set( "Claudia Chauchat", 578666, 27 );
   stud.write( outFile );
   outFile.close();
*/
   fstream inFile( "Studs.seq", ios::binary | ios::in );  // read
   while( stud.read( inFile ) )
      stud.print();
   inFile.close();

   return 0;
}