【发布时间】:2016-04-27 21:58:51
【问题描述】:
所以我为一个位置创建了一个类,我在其中存储它的坐标和时间,以 UTC 格式。我像这样重载了 >> 运算符
friend ifstream& operator >>(ifstream& in, loc_list& l)
{
char bf[40];
in >> bf;
l.setID(bf);
long t=0;
in >> l.utc;
//l.setTime(t);
double point;
in >> point;
l.p.setX(point);
in >> point;
l.p.setY(point);
in >> l.speed;
return in;
}
和
friend ostream& operator <<(ostream& out,const loc_list &l)
{
out << l.id << endl;
out << put_time(gmtime(&l.utc),"%c %Z" )<< endl;
//out << l.utc << endl;
out << l.p.getX() << endl;
out << l.p.getY() << endl;
out << l.speed;
return out;
}
但是,> 阅读它时,它会中断。 我已经调试了程序,但对象包含正确的数据 print from debugger
那么,有什么想法吗?
【问题讨论】:
-
它是如何以及具体在哪里中断的?
-
这里爆发了