#include
#include
#include
#include
#include"stdlib.h"
using namespace std;
const char* file="file.dat";
//===================================================
class plaint{
private:
string name;
string population;
string g;
inline void eatline(){while(cin.get()!='/n') continue;}
public:
plaint(){}
plaint(string name,string population,string g):name(name),population(population),g(g){}
void show();
};
//==================================
int plaint::ct=0;
void plaint::show(){
ifstream fin;
fin.open(file,ios::binary);//打开文件
if(fin.is_open()){
fin.seekg(0);
cout<<"open the file.dat"<<endl;
fin.read((char*)&this,sizeof(plaint));
cout<<" :"<<name<<endl;
if(fin.eof()){
fin.clear();
}
else{
cout<<"error in reading";
exit(EXIT_FAILURE);
}
}
else{
cout<<"error in reading";
exit(EXIT_FAILURE);
}
}
//=====================================================
void main(){
plaint p1;
p1.show();
}