Sunday, September 4, 2011

Using FD_CLR Macro


select FD_CLR

This C macro undoes the effect of the FD_SET macro. Assuming a socket c once again, if the calling program wants to remove this descriptor from the set, it can perform the following:

Example

int c;             /* Client socket */
fd_set read_socks; /* Read set */
. . .
FD_CLR(c, &read_socks);

The FD_CLR macro has the effect that it zeros the corresponding bit representing the file descriptor. Note that this macro differs from FD_ZERO in that it only clears one specific file descriptor.

No comments:

Post a Comment