Re: fd_sets and std[fd]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Jim Stapleton" <stapleton.41@xxxxxxxxx> writes:

> can you put stdin/stdout/stderr in an fdset (well, really only
> interested in stdin) and then use it in select?
> 
> I'm curious because these are pointers to struct and not actual
> integers like sockets, but some documentation I read said you could do
> this, and shows socket fd's and these structure pointers used
> interchangeably, which just confuses me. Every fiber of my programming
> being wants to put stdin->_fileno in their instead, as sockets and
> filenumbers are supposed to be the same according to the
> documentation.

Wrong mailing list.  This is a Unix programming question, not a gcc
question.

Here is my answer, but please don't followup to the list, and please
don't followup to me personally.  Go to a Unix programming list.
Thanks.

Yes, you can put fileno(stdin) in an fd_set.  But it may not tell you
exactly what you want, as there may be some data buffered up to read
in the STDIO structure.  In that case, select would indicate that
there is no data to be read, but in fact there would be some
available.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux