Skip to content

Commit

Permalink
Fix reading from stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Jul 30, 2024
1 parent 45a2474 commit bade114
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cli/convert-json-toml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <openPMD/auxiliary/JSON_internal.hpp>

#include <iostream>
#include <sstream>
#include <string>

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

0 comments on commit bade114

Please sign in to comment.