| 14 | } |
| 15 | |
| 16 | std::string loadFile(const std::string& file) |
| 17 | { |
| 18 | std::string ret = ""; |
| 19 | |
| 20 | char *buff = nullptr; |
| 21 | |
| 22 | FILE *fp = fopen(file.c_str(), "rb"); |
| 23 | if (fp) { |
| 24 | fseek(fp, 0, SEEK_END); |
| 25 | size_t size = ftell(fp); |
| 26 | fseek(fp, 0, SEEK_SET); |
| 27 | buff = new char[size]; |
| 28 | if (fread(buff, 1, size, fp) == size) { |
| 29 | ret.assign(buff, size); |
| 30 | } |
| 31 | delete [] buff; |
| 32 | fclose(fp); |
| 33 | } |
| 34 | return ret; |
| 35 | } |
| 36 | |
| 37 | json_value* get_object_key(json_value *root, const std::string& key) |
| 38 | { |
no test coverage detected