57 m_handle = {CreateFile(
file.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
nullptr)};
66 std::size_t flag{O_ASYNC | O_DSYNC | O_NOCTTY | O_SYNC | O_NDELAY};
67 flag &= ~static_cast<std::size_t>(O_NONBLOCK);
68 if(mode.find(
'r') != std::string::npos) { flag |= O_RDONLY; }
69 else if(mode.find(
'w') != std::string::npos) { flag |= O_WRONLY; }
70 else { flag |= O_RDWR; }
71 m_fd = {::open(
file.c_str(),
static_cast<int>(flag))};
160 std::string ret(4096,
'\0');
162 ReadConsole(
Private::in.
handle(), &ret[0],
static_cast<DWORD
>(ret.size()), &nread,
nullptr);
165 #if defined(MAX_INPUT)
166 static const constexpr std::size_t max_input{MAX_INPUT};
168 static const constexpr std::size_t max_input{256};
170 #if defined(_POSIX_MAX_INPUT)
171 static const constexpr std::size_t posix_max_input{_POSIX_MAX_INPUT};
173 static const constexpr std::size_t posix_max_input{256};
175 static std::size_t nread{std::max(max_input, posix_max_input)};
177 std::string ret(nread,
'\0');