|
|
|
|
|
|
|
|
|
|
|
|
|
|
size_t nBytesAvailable = egptr() - gptr();
|
|
|
size_t nBytesAvailable = egptr() - gptr();
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
|
DWORD lpTotalBytesAvail;
|
|
|
|
|
|
|
|
|
|
|
|
if (!PeekNamedPipe(inputHandle,
|
|
|
|
|
|
NULL,
|
|
|
|
|
|
0,
|
|
|
|
|
|
NULL,
|
|
|
|
|
|
&lpTotalBytesAvail,
|
|
|
|
|
|
NULL)) {
|
|
|
|
|
|
throw std::runtime_error("Error from PeekNamedPipe: " +
|
|
|
|
|
|
getErrorText());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (lpTotalBytesAvail > 0) {
|
|
|
|
|
|
nBytesAvailable++;
|
|
|
|
|
|
}
|
|
|
|
|
|
#else
|
|
|
fd_set readFd;
|
|
|
fd_set readFd;
|
|
|
int retVal;
|
|
|
int retVal;
|
|
|
struct timeval timeout = {0, 0};
|
|
|
struct timeval timeout = {0, 0};
|
|
|
|
|
|
|
|
|
} else if (retVal > 0) {
|
|
|
} else if (retVal > 0) {
|
|
|
nBytesAvailable++;
|
|
|
nBytesAvailable++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
return nBytesAvailable;
|
|
|
return nBytesAvailable;
|
|
|
|
|
|
|