⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 select.c

📁 一个C源代码分析器
💻 C
字号:
#include <stdio.h>#include <unistd.h>#include <sys/types.h>#include <sys/time.h>int input_timeout (int filedes, unsigned int seconds){  fd_set set;  struct timeval timeout;  /* Initialize the file descriptor set. */  FD_ZERO (&set);  FD_SET (filedes, &set);  /* Initialize the timeout data structure. */  timeout.tv_sec = seconds;  timeout.tv_usec = 0;  /* @code{select} returns 0 if timeout, 1 if input available, -1 if error. */  return TEMP_FAILURE_RETRY (select (FD_SETSIZE,				     &set, NULL, NULL,				     &timeout));}intmain (void){  fprintf (stderr, "select returned %d.\n",	   input_timeout (STDIN_FILENO, 5));  return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -