Use _fileno(stdin) instead of STDIN_FILENO on Windows

The `*_FILENO` constants don't exist on Windows.

PiperOrigin-RevId: 518553512
pull/13171/head
Joshua Haberman 2 years ago committed by Copybara-Service
parent b7437a1b0e
commit 8562ccc1f0
  1. 4
      upbc/plugin.h

@ -163,8 +163,8 @@ class Plugin {
std::string ReadAllStdinBinary() {
std::string data;
#ifdef _WIN32
setmode(STDIN_FILENO, _O_BINARY);
setmode(STDOUT_FILENO, _O_BINARY);
_setmode(_fileno(stdin), _O_BINARY);
_setmode(_fileno(stdout), _O_BINARY);
#endif
char buf[4096];
while (size_t len = fread(buf, 1, sizeof(buf), stdin)) {

Loading…
Cancel
Save