I have some code using the select function that compiles and runs fine in Linux. But I'm trying to port it to Windows and am getting this error I don't know how to deal with. It says
STDIN_FILENO: undeclared identifier
I haven't been able to come up with or find any solution for this. Is there a way to make STDIN_FILENO work in Windows?
MSDN suggests the use of _fileno(stdin)
, where _fileno
is declared in <stdio.h>
.
Note, however:
If stdout or stderr is not associated with an output stream (for example, in a Windows application without a console window), the file descriptor returned is -2. In previous versions, the file descriptor returned was -1. This change allows applications to distinguish this condition from an error.
STDIN_FILENO is a definition of standard POSIX,
Try 0 !
I apologize for answering so late, but I have solved this problem adding unistd.h
on gcc compiler. So, try to add
#include <unistd.h>
Useful reference link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With