| 56 | } |
| 57 | |
| 58 | static JSONCPP_STRING readInputTestFile(const char* path) { |
| 59 | FILE* file = fopen(path, "rb"); |
| 60 | if (!file) |
| 61 | return JSONCPP_STRING(""); |
| 62 | fseek(file, 0, SEEK_END); |
| 63 | long const size = ftell(file); |
| 64 | unsigned long const usize = static_cast<unsigned long>(size); |
| 65 | fseek(file, 0, SEEK_SET); |
| 66 | JSONCPP_STRING text; |
| 67 | char* buffer = new char[size + 1]; |
| 68 | buffer[size] = 0; |
| 69 | if (fread(buffer, 1, usize, file) == usize) |
| 70 | text = buffer; |
| 71 | fclose(file); |
| 72 | delete[] buffer; |
| 73 | return text; |
| 74 | } |
| 75 | |
| 76 | static void |
| 77 | printValueTree(FILE* fout, Json::Value& value, const JSONCPP_STRING& path = ".") { |