I tried the things above, but the fact is that they do not work in C ++ 14 for me: P I get something like ifstream incomplete type is not allowed in both answers And 2 json11 :: Json does not have ::Reader or ::Value , so answer 2 does not work either I will thin out the answoer for ppl that use this https://github.com/dropbox/json11 - do something like this:
ifstream ifile; int fsize; char * inBuf; ifile.open(file, ifstream::in); ifile.seekg(0, ios::end); fsize = (int)ifile.tellg(); ifile.seekg(0, ios::beg); inBuf = new char[fsize]; ifile.read(inBuf, fsize); string WINDOW_NAMES = string(inBuf); ifile.close(); delete[] inBuf; Json my_json = Json::object { { "detectlist", WINDOW_NAMES } }; while(looping == true) { for (auto s : Json::array(my_json)) {
Note: this is in a loop as I wanted it to loop data. Please note: there are some errors in it, but at least I opened the file in contrast to the above.
source share