?? test12_4.txt
字號(hào):
#include <sys/time.h>
#include <sys/select.h>
#include <unistd.h>
#define STDIN 0
/*標(biāo)準(zhǔn)輸入設(shè)備的描述字為0 */
main()
{
struct timeval tv;
fd_set readfds;
tv.tv_sec=2;
tv.tv_usec=500000;
/*設(shè)置時(shí)間片為2.5秒 */
FD_ZERO(&readfds);
FD_SET(STDIN,&readfds);
/*設(shè)置讀文件集readfds為標(biāo)準(zhǔn)輸入,不關(guān)心writefds和exceptfds */
select(STDIN+1,&readfds,NULL,NULL,&tv);
if(FD_ISSET(STDIN,&readfds))
printf("A key was pressed!\n");
else
printf("Timed out.\n");
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -