文本文件:
a1 |人A | ABC | 12345678 | K.T 1号楼A室
a2 |人B | ABC | 123456 | H,K,K,2号楼H室|成员
ifstream file _(“ user.txt”);
if (file_.is_open())
{
string line;
string id;
string name;
string section;
string password_s;
string address;
string rank;
string line;
while (getline(file_,line))
{
//split the text data
}
file_.close();
}
else {
cout << "file is not open" << endl;
}