Json文件:
[
{"A":"sample1","B":"sample2","C":"sample3,"D":"sample4"},
{"A":"sample5","B":"sample6","C":"sample7,"D":"sample8"},
{"A":"samplea","B":"sampleb","C":"sampleb,"D":"sampleb"},
.
.
.
}
]
我的输入文件中有2075980个这样的条目
struct entry_t
{
U64 param;
}
entry_t entry;
Json::Value root;
Json::Reader reader;
ifstream test("json_file", ifstream::binary);
if(!reader.parse(test, root, false))
{
cout << reader.getFormattedErrorMessages() << endl;}
else
{
for(unsigned int i = 0; i < root.size(); i++)
{
entry.param = root[i].get("A", "null").asInt();
}
}
上面的代码工作正常,直到472783th循环。在以下循环中,尝试访问“entry.param”时出现seg错误
我是C ++和jsoncpp的新手,无法找出seg错误的原因。
答案 0 :(得分:0)