资料读取输入不成功阿

文件读取输入不成功阿这个是读取文件student *psheadifstream infile(txl.dat,ios::in|ios::binary)w

文件读取输入不成功阿
这个是读取文件
 student *ps=head;
 ifstream infile("txl.dat",ios::in|ios::binary);  
  while(ps)
{
infile.read((char*)&ps->stud,sizeof(ps->stud));
ps=ps->next;
} //从文件中读取所有信息 
 infile.close();

 这个是向文件输入
 student *ps=head;
 ofstream outfile;  
 outfile.open("txl.dat",ios::binary|ios::trunc);  
  while(ps)  
  {
outfile.write((char *)&ps->stud,sizeof(ps->stud));
ps=ps->next;
  }
 outfile.close();

[解决办法]
链表是已经建好了的吗?