Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <windows.h>
- #include <winsock2.h>
- #define STDIN 0
- int main(void)
- {
- WSADATA wsaData;
- WSAStartup(MAKEWORD(2,2), &wsaData);
- struct timeval tv;
- fd_set readfds;
- tv.tv_sec = 5;
- tv.tv_usec = 0;
- FD_ZERO(&readfds);
- FD_SET(STDIN, &readfds);
- select(STDIN+1, &readfds, NULL, NULL, NULL);
- if (FD_ISSET(STDIN, &readfds))
- printf("input\n");
- else
- printf("timed out\n");
- WSACleanup();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement