Using select() system call for listening on stdin and the server

对着背影说爱祢 提交于 2019-12-06 03:47:50

What is STDIN? There is stdin which is declared in <stdio.h>, is a FILE* and not a file descriptor so can't be used in an fdset and STDIN_FILENO, which is defined in <unistd.h> and is a file descriptor and thus can be used with fdsets.

BTW, in <stdio.h> there is also a function fileno() which returns the file descriptor of a FILE* (depending on your compilation flags, you may need to define some feature macros to get the declaration).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!