I am trying to use integer values from a list in a JSON file, but I seem to be having trouble with parsing the file.
I tried changing the line "Reader reader;" to "CharReader reader;", but that doesn't work with the parse function.
#include <fstream>
#include "json\json.h"
using namespace std;
using namespace Json;
int main()
{
ifstream f("settings.json");
Reader reader; // line 11
Value settings;
f >> settings;
reader.parse(f, settings); // line 14
Value rxv = settings["res"][0u];
Value ryv = settings["res"][1u];
int screenres_x = rxv.asInt();
int screenres_y = ryv.asInt();
Content of JSON:
{
"res": [1024, 768],
"windowed": true,
"fpscap": true
}
I expect the settings value to contain the contents of the JSON file, but I am getting the following errors:
"'Json::Reader': Use CharReader and CharReaderBuilder instead." on line 11
"'Json::Reader::__autoclassinit2': Use CharReader and CharReaderBuilder instead." on line 11
"'Json::Reader::Reader': Use CharReader and CharReaderBuilder instead." on line 11
"'Json::Reader::parse': Use CharReader and CharReaderBuilder instead." on line 14