143k views
1 vote
What structure do you put open file descriptors in order to use them with select?

a) fd_set
b) FILE
c) socket_set
d) descriptor_set

User Sarvasana
by
7.5k points

1 Answer

6 votes

Final answer:

To use open file descriptors with the select function, they must be placed in a structure called fd_set. This structure allows select to monitor multiple file descriptors for I/O operations.

Step-by-step explanation:

The structure you put open file descriptors into in order to use them with select is a) fd_set. The select function is used in programming to monitor multiple file descriptors, waiting until one or more of the file descriptors become "ready" for some class of I/O operation (e.g., input possible). An fd_set is a data structure that can store a set of file descriptors. When using select, one typically initializes an fd_set with FD_ZERO, then adds file descriptors with FD_SET, and finally calls select. If select indicates that a file descriptor is ready, it can be tested with FD_ISSET.

User Adanlif
by
7.5k points