outfile 报错

[复制链接]
查看11 | 回复1 | 2010-11-30 11:25:13 | 显示全部楼层 |阅读模式
void input()
{int i=0,n;
ifstream infile("info.dat",ios::in|ios::binary);
if (!infile)
{
cout > n;
cout > (stu.sno);

cout > (stu.sname);
cout > (stu.score);
outfile.write((char *)&stu,sizeof(stu));
}
outfile.close();
return;
}
error C2065: 'outfile' : undeclared identifier
error C2228: left of '.write' must have class/struct/union type
error C2228: left of '.close' must have class/struct/union type

回复

使用道具 举报

千问 | 2010-11-30 11:25:13 | 显示全部楼层
outfile 没有定义啊。 可能是少抄了一行:ofstream outfile("...");
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行