Skip to content

Commit

Permalink
apacheGH-35007: [C++] Fix reading stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
resetius committed Apr 10, 2023
1 parent 2e6c13d commit d308833
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions cpp/src/arrow/io/stdio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,9 @@ Result<int64_t> StdinStream::Tell() const { return pos_; }

Result<int64_t> StdinStream::Read(int64_t nbytes, void* out) {
std::cin.read(reinterpret_cast<char*>(out), nbytes);
if (std::cin) {
pos_ += nbytes;
return nbytes;
} else {
return 0;
}
nbytes = std::cin.gcount();
pos_ += nbytes;
return nbytes;
}

Result<std::shared_ptr<Buffer>> StdinStream::Read(int64_t nbytes) {
Expand Down

0 comments on commit d308833

Please sign in to comment.