int fd=open("/dev/tty",O_RDWR|O_NONBLOCK);
//fcntl()函数,设置非阻塞 int flags = fcntl(fd,F_GETFL); flags |= O_NONBLOCK; fcntl(fd,F_SETFL,flags);
linux c++(IO & 第二篇)
原文:https://www.cnblogs.com/lodger47/p/14727289.html