[問題] 關於read的問題

看板C_and_CPP作者 (小鄭)時間12年前 (2012/01/02 20:04), 編輯推噓2(202)
留言4則, 4人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) C++ include<fcntl.h>後 使用read(int handle, void *buffer, int nbyte)函數 然後用來讀/dev/input/event0 沒有輸入的話會卡住 想問問看看有沒有timeout可以設定 謝謝!!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.113.169.88 ※ 編輯: doasaman 來自: 140.113.169.88 (01/02 20:12)

01/02 21:33, , 1F
select ?
01/02 21:33, 1F

01/02 21:46, , 2F
handle是不是要設定為nonblocking
01/02 21:46, 2F

01/03 08:50, , 3F
select 比較符合你的要求.要不然就自己寫timer吧
01/03 08:50, 3F

01/03 11:47, , 4F
找個 socketnotifier.h 來用吧
01/03 11:47, 4F
文章代碼(AID): #1F0PrY71 (C_and_CPP)