dropbox / json11

A tiny JSON library for C++11.
MIT License
2.55k stars 615 forks source link

could I somehow pass a file object into this and have it read the contents of the file on this? #58

Closed AraHaan closed 8 years ago

AraHaan commented 8 years ago
ifstream ifile;
int fsize;
char * inBuf;
ifile.open("res/test.json", ios_base::binary);
ifile.seekg(0, ios::end);
fsize = ifile.tellg();
ifile.seekg(0, ios::beg);
inBuf = new char[fsize];
ifile.read(inBuf, fsize);
string WINDOW_NAMES = (LPCSTR)ifile;
ifile.close();
int _json_data_ready = (int)WINDOW_NAMES;
Json my_json = Json::object{_json_data_ready};
while(looping == true) {
    for (auto s : Json::array(my_json)) {
        //code here.
    };
};

Note: this code might generate at least 4 errors and 1 warning also note I am fairly new at C++ but at least I know how file objects work somewhat in Python in Visual Basic. Anyway I want to know if I could do soemthing like this? when the Json would look something like this

{"detectlist": ["Cheat Engine 6.1", "Cheat Engine 6.2", "Cheat Engine 6.3", "Cheat Engine 6.4", "Cheat Engine 6.5", "Cheat Engine 6.6", "Cheat Engine 6.7", "Cheat Engine 6.8", "Cheat Engine 6.9", "Cheat Engine 7.0", "OllyDBG", "PEiD v0.95"]}

Note the json will always change and as such I dont want to always change my DLL just because the json changes as what would the point of the json be?