128{
129#if defined(_WIN32)
130 DWORD nread{0};
131 std::string ret(4096, '\0');
132 errno = 0;
133 ReadConsole(
Private::in.
handle(), &ret[0],
static_cast<DWORD
>(ret.size()), &nread,
nullptr);
134 return ret.c_str();
135#else
136 #if defined(MAX_INPUT)
137 static const constexpr std::size_t max_input{MAX_INPUT};
138 #else
139 static const constexpr std::size_t max_input{256};
140 #endif
141 #if defined(_POSIX_MAX_INPUT)
142 static const constexpr std::size_t posix_max_input{_POSIX_MAX_INPUT};
143 #else
144 static const constexpr std::size_t posix_max_input{256};
145 #endif
146 static std::size_t nread{std::max(max_input, posix_max_input)};
148 std::string ret(nread, '\0');
149 if(nread != 0)
150 {
152 }
153 return ret;
154#endif
155}
void throw_exception(const std::string &str={}) const
Errno & check_if(const bool &ret) noexcept
Handle handle() const noexcept
std::int32_t fd() const noexcept
bool is_stdin_a_tty()
Check if stdin is a tty.