mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-09-11 13:55:22 -04:00
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).
parent
4ed1ed63e4
commit
0a11c2cd7b
10
Home.md
10
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 <fstream>
|
||||
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user