From a021c3fbe2542c840346bf75380dcdf1cc6b712f Mon Sep 17 00:00:00 2001 From: Paul C Roberts Date: Wed, 19 Aug 2015 15:00:12 -0700 Subject: [PATCH] Fixes bug in parse_from_stdin Handles end of file correctly --- test.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test.cpp b/test.cpp index f6fb547..8b62aeb 100644 --- a/test.cpp +++ b/test.cpp @@ -25,7 +25,10 @@ CHECK_TRAIT(is_nothrow_destructible); void parse_from_stdin() { string buf; - while (!std::cin.eof()) buf += std::cin.get(); + string line; + while (std::getline(std::cin, line)) { + buf += line + "\n"; + } string err; auto json = Json::parse(buf, err);