From 0a11c2cd7b6eb5b3035dadd34ad1e355e6c79558 Mon Sep 17 00:00:00 2001 From: Daniel Polanco Date: Wed, 4 Feb 2015 21:10:46 -0700 Subject: [PATCH] Clarify confusion regarding code example as seen here: http://stackoverflow.com/questions/4273056/jsoncpp-not-reading-files-correctly (i.e. I had the same problem). --- Home.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Home.md b/Home.md index a8922aa..0c2d7ac 100644 --- a/Home.md +++ b/Home.md @@ -28,6 +28,16 @@ Features Code example ------------ +You must open the file in an `std::ifstream` before you can use it: + +```cpp +#include + +std::ifstream config_doc("config_doc.json", std::ifstream::binary); +``` + +Once that is done you can then use jsoncpp to parse the data: + ```cpp Json::Value root; // will contains the root value after parsing Json::Reader reader;