以下是代码
#include
#include
#include
#include
using namespace std;
class Hehe
{
int id;
string des;
public:
Hehe(){}
Hehe(int a,string b):id(a),des(b){}
int Getx(){return id;}
};
void main()
{
fstream p("a.txt",ios::in|ios::binary);
if (p.fail())
{
cout << "p文件打开失败";
exit(0);
}
vector
while (!p.eof())
{
Hehe hehe;
p.read((char*)&hehe, sizeof(Hehe));
h.push_back(hehe);
}
}
运行出现如图情况,求大神指导。