Reputation: 1
Json file:
[
{"A":"sample1","B":"sample2","C":"sample3,"D":"sample4"},
{"A":"sample5","B":"sample6","C":"sample7,"D":"sample8"},
{"A":"samplea","B":"sampleb","C":"sampleb,"D":"sampleb"},
.
.
.
}
]
I have 2075980 such entries in my input file
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();
}
}
above code works fine until 472783th loop. in the following loop, getting a seg fault while trying to access "entry.param"
I am new to C++ and jsoncpp and not able to figure out the cause of the seg fault.
Upvotes: 0
Views: 400