Skip to content

Commit 58497f1

Browse files
committed
Fix reading from stdin
1 parent efa1047 commit 58497f1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/cli/convert-json-toml.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <openPMD/auxiliary/JSON_internal.hpp>
44

55
#include <iostream>
6+
#include <sstream>
67
#include <string>
78

89
namespace json = openPMD::json;
@@ -38,7 +39,11 @@ int main(int argc, char const **argv)
3839
// Just read the whole stream into memory
3940
// Not very elegant, but we'll hold the entire JSON/TOML dataset
4041
// in memory at some point anyway, so it doesn't really matter
41-
std::cin >> jsonOrToml;
42+
{
43+
std::stringbuf readEverything;
44+
std::cin >> &readEverything;
45+
jsonOrToml = readEverything.str();
46+
}
4247
break;
4348
case 2:
4449
if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0)

0 commit comments

Comments
 (0)