将文件流式传输到struct

时间:2016-02-26 19:08:19

标签: c++

[Column("foo")]
public string foo { get; set; }

上述代码导致SIGESV错误。

以下代码不会导致SIGESV:

struct S {
char[10] bytes;
uint64_t t;
};


ifstream& operator>>(ifstream& ref, S& s){
  ref >> s.bytes;
  ref >> s.t;
return ref;
}
int main(){
S s;
ifstream file(/*OPEN STH*/);
file >> s;
};

所以我们可以看到问题是当成员字节是char数组时。为什么?如何解决这个问题?

0 个答案:

没有答案