Windows does not support using select
for arbitrary handles. In Linux and other forms of Unix, "all handles are equal", and it's not important whether they are handles for console, a socket or anything else.
Note that select
in windows does not take a HANDLE
, but a special SOCKET
type of handle. See the definition of Windows' fd_set
.
The easiest solution is probably to use a second thread to read the console input. There is certainly no way to include the console into your select
call. There may be ways to convince Windows that a SOCKET
is a waitable object, and use it for something like WaitForMultipleObjects
, along with a console input handle - but I'm far from convinced (and I don't have a windows setup to try it out on).